Commit Graph

255 Commits

Author SHA1 Message Date
Michael Niedermayer 1aeb88b77d Correctly implement ac3 float/fixed encoder.
There is no need to have 2 encoders, the input sample format can,does and should choose which is used
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-04-16 23:24:10 +02:00
Michael Niedermayer 434f248723 Merge remote branch 'qatar/master'
* qatar/master: (22 commits)
  ac3enc: move extract_exponents inner loop to ac3dsp
  avio: deprecate url_get_filename().
  avio: deprecate url_max_packet_size().
  avio: make url_get_file_handle() internal.
  avio: make url_filesize() internal.
  avio: make url_close() internal.
  avio: make url_seek() internal.
  avio: cosmetics, move AVSEEK_SIZE/FORCE declarations together
  avio: make url_write() internal.
  avio: make url_read_complete() internal.
  avio: make url_read() internal.
  avio: make url_open() internal.
  avio: make url_connect internal.
  avio: make url_alloc internal.
  applehttp: Merge two for loops
  applehttp: Restructure the demuxer to use a custom AVIOContext
  applehttp: Move finished and target_duration to the variant struct
  aacenc: reduce the number of loop index variables
  avio: deprecate url_open_protocol
  avio: deprecate url_poll and URLPollEntry
  ...

Conflicts:
	libavformat/applehttp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-04-05 02:31:56 +02:00
Mans Rullgard 2310ee4b1c ac3enc: move extract_exponents inner loop to ac3dsp
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-04-04 18:27:22 +01:00
Justin Ruggles e05a3ac713 ac3enc: select bandwidth based on bit rate, sample rate, and number of
full-bandwidth channels.

This reduces high-frequency artifacts and improves the quality of the lower
frequency audio at low bit rates.
2011-04-03 20:59:14 -04:00
Michael Niedermayer 2cae9809e2 Merge remote branch 'qatar/master'
* qatar/master:
  fate: fix partial run when no samples path is specified
  ARM: NEON fixed-point forward MDCT
  ARM: NEON fixed-point FFT
  lavf: bump minor version and add an APIChanges entry for avio changes
  avio: simplify url_open_dyn_buf_internal by using avio_alloc_context()
  avio: make url_fdopen internal.
  avio: make url_open_dyn_packet_buf internal.
  avio: avio_ prefix for url_close_dyn_buf
  avio: avio_ prefix for url_open_dyn_buf
  avio: introduce an AVIOContext.seekable field
  ac3enc: use generic fixed-point mdct
  lavfi: add fade filter
  Change yadif to not use out of picture lines.
  lavc: deprecate AVCodecContext.antialias_algo
  lavc: mark mb_qmin/mb_qmax for removal on next major bump.

Conflicts:
	doc/filters.texi
	libavcodec/ac3enc_fixed.h
	libavcodec/ac3enc_float.h
	libavfilter/Makefile
	libavfilter/allfilters.c
	libavfilter/vf_fade.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-04-04 02:15:12 +02:00
Mans Rullgard 79997def65 ac3enc: use generic fixed-point mdct
This makes the AC3 encoder use the shared fixed-point MDCT rather
than its own implementation.  The checksum changes are due to
different rounding in the MDCT.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-04-03 19:01:53 +01:00
Michael Niedermayer 7ac167493e Merge remote-tracking branch 'newdev/master'
* newdev/master:
  mpegts: propagate avio EOF in read_packet()
  configure: Initial support for --target-os=symbian
  Fixed-point FFT and MDCT
  Include dependencies for test programs
  ac3enc: simplify sym_quant()
  flvdec: read index stored in the 'keyframes' tag.
  mov: Add support for zero-sized stsc runs.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-04-01 02:58:15 +02:00
Mans Rullgard 7f6e05cdfd ac3enc: simplify sym_quant()
These expressions are equivalent since levels is always odd, and
overflow is impossible due to the constraints set by the assert().

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-31 12:01:27 +01:00
Michael Niedermayer 445fdc0140 Merge remote-tracking branch 'newdev/master'
* newdev/master:
  ac3enc: move compute_mantissa_size() to ac3dsp
  ac3enc: move mant*_cnt and qmant*_ptr out of AC3EncodeContext
  Remove support for stripping executables
  ac3enc: NEON optimised float_to_fixed24
  ac3: move ff_ac3_bit_alloc_calc_bap to ac3dsp
  dfa: protect pointer range checks against overflows.
Duplicate:  mimic: implement multithreading.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-03-30 03:09:08 +02:00
Mans Rullgard 52fd16a264 ac3enc: move compute_mantissa_size() to ac3dsp
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-30 01:21:56 +01:00
Mans Rullgard 6f718471ea ac3enc: move mant*_cnt and qmant*_ptr out of AC3EncodeContext
These fields are only used in quantize_mantissas() and reset
on each call, no need to store them in the main context.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-30 00:38:45 +01:00
Mans Rullgard 6d9f52b2cd ac3: move ff_ac3_bit_alloc_calc_bap to ac3dsp
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-29 19:31:45 +01:00
Michael Niedermayer 59bf303d68 Merge remote-tracking branch 'newdev/master'
* newdev/master:
  ac3enc: avoid memcpy() of exponents and baps in EXP_REUSE case by using exponent reference blocks.
  Chronomaster DFA decoder
DUPLICATE:  framebuffer device demuxer
NOT MERGED: cosmetics: fix dashed line length after 070c5d0
  http: header field names are case insensitive

Conflicts:
	LICENSE
	README
	doc/indevs.texi
	libavdevice/fbdev.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-03-29 02:46:11 +02:00
Justin Ruggles c4549bd66a ac3enc: avoid memcpy() of exponents and baps in EXP_REUSE case by using
exponent reference blocks.
2011-03-28 14:46:17 -04:00
Michael Niedermayer 25d8099beb Merge remote-tracking branch 'newdev/master'
* newdev/master:
  ac3enc: Add codec-specific options for writing AC-3 metadata.
NOT MERGED:  Remove arrozcru URL from documentation
  sndio support for playback and record

Conflicts:
	doc/faq.texi
	doc/general.texi

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-03-28 01:50:36 +02:00
Justin Ruggles 991f3de1bb ac3enc: Add codec-specific options for writing AC-3 metadata. 2011-03-27 11:30:09 -04:00
Michael Niedermayer 27ef7b1bcd Merge remote-tracking branch 'newdev/master'
* newdev/master:
  mov: set audio service type for AC-3 from bitstream mode in the 'dac3' atom.
  Get audio_service_type for AC-3 based on bitstream mode in the AC-3 parser and decoder, and vice-versa for the AC-3 encoder.
  Use audio_service_type to set stream disposition.
  Add APIchanges entry for audio_service_type.
  Add audio_service_type field to AVCodecContext for encoding and reporting of the service type in the audio bitstream.
  configure: in check_ld, place new -l flags before existing ones
  support @heading, @subheading, @subsubheading, and @subsubsection in texi2pod.pl
  doc: update build system documentation
  aacenc: indentation
  aacenc: fix the side calculation in search_for_ms
  vp8.c: rename EDGE_* to VP8_EDGE_*.

Conflicts:
	doc/APIchanges
	libavcodec/avcodec.h
	libavcodec/version.h
	libavcodec/vp8.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-03-26 03:06:30 +01:00
Justin Ruggles be18738801 Get audio_service_type for AC-3 based on bitstream mode in the AC-3 parser
and decoder, and vice-versa for the AC-3 encoder.
2011-03-25 16:59:00 -04:00
Michael Niedermayer 2fd41c9067 Merge remote-tracking branch 'newdev/master'
* newdev/master:
  avio: make udp_set_remote_url/get_local_port internal.
  asfdec: also subtract preroll when reading simple index object
  matroskaenc: remove a variable that's unused after bc17bd9.
  avio: cosmetics - nicer vertical alignment.
  Remove unnecessary icc version checks
  Disable 'attribute "foo" ignored' warnings from icc
  rtsp: Don't use a locale dependent format string
  Add xd55 codec tag for XDCAM HD422 720p25 CBR files.
  configure: get libavcodec version from new version.h header
  lavc: move the version macros to a new installed header.
  matroskaenc: simplify get_aac_sample_rates by using ff_mpeg4audio_get_config
  Do not use format string "%0.3f" for RTSP Range field.
  Add apply_window_int16() to DSPContext with x86-optimized versions and use it in the ac3_fixed encoder.
  Document usage of import libraries created by dlltool
  configure: Set the correct lib target for arm/wince dlltool
  fate: simplify regression-funcs.sh
  fate: add support for multithread testing

Conflicts:
	libavformat/rtspdec.c
	libavutil/attributes.h
	libavutil/internal.h
	libavutil/mem.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-03-24 02:16:11 +01:00
Michael Niedermayer 4fa0e24736 Merge remote-tracking branch 'newdev/master'
* newdev/master: (33 commits)
  Fix an infinite loop when RoQ encoded generated a frame with a size greater than the maximum valid size.
  Add kbdwin.o to AC3 decoder
  Detect byte-swapped AC-3 and support decoding it directly.
  cosmetics: indentation
  Always copy input data for AC3 decoder.
  ac3enc: make sym_quant() branch-free
  cosmetics: indentation
  Add a CPU flag for the Atom processor.
  id3v2: skip broken tags with invalid size
  id3v2: don't explicitly skip padding
  Make sure kbhit() is in conio.h
  fate: update wmv8-drm reference
  vc1: make P-frame deblock filter bit-exact.
  configure: Add the -D parameter to the dlltool command
  amr: Set the AVFMT_GENERIC_INDEX flag
  amr: Set the pkt->pos field properly to the start of the packet
  amr: Set the codec->bit_rate field based on the last packet
  rtsp: Specify unicast for TCP interleaved streams, too
  Set the correct target for mingw64 dlltool
  applehttp: Change the variable for stream position in seconds into int64_t
  ...

Conflicts:
	ffmpeg.c
	ffplay.c
	libavcodec/ac3dec.c
	libavformat/avio.h
	libavformat/id3v2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-03-23 02:42:56 +01:00
Justin Ruggles e6e9823488 Add apply_window_int16() to DSPContext with x86-optimized versions and use it
in the ac3_fixed encoder.
2011-03-22 21:08:30 -04:00
Justin Ruggles 85ab290470 ac3enc: make sym_quant() branch-free 2011-03-22 14:36:18 -04:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Justin Ruggles 0f999cfddb ac3enc: add float_to_fixed24() with x86-optimized versions to AC3DSPContext
and use in scale_coefficients() for the floating-point AC-3 encoder.
2011-03-17 16:46:48 -04:00
Justin 323e6fead0 ac3enc: do not right-shift fixed-point coefficients in the final MDCT stage.
This increases the accuracy of coefficients, leading to improved quality.
Rescaling of the coefficients to full 25-bit accuracy is done rather than
offsetting the exponent values. This requires coefficient scaling to be done
before determining the rematrixing strategy. Also, the rematrixing strategy
calculation must use 64-bit math to prevent overflow due to the higher
precision coefficients.
2011-03-14 08:45:26 -04:00
Justin Ruggles 2d9a101a1f ac3enc: add some assertions 2011-03-07 11:18:59 -05:00
Justin Ruggles 7100d63ca5 ac3enc: use av_assert2() instead of assert() to make debugging easier. 2011-03-07 11:18:51 -05:00
Justin Ruggles 53e35fd340 ac3enc: add num_rematrixing_bands to AC3EncodeContext and use it instead of the hardcoded value.
Currently it is always 4, but this change will allow it to be adjusted when
bandwidth-related features are added such as channel coupling, enhanced
channel coupling, and spectral extension.
2011-03-04 17:40:24 -05:00
Justin Ruggles 5b54d4b376 ac3enc: fix bug in stereo rematrixing decision.
The rematrixing strategy reuse flags are not reset between frames, so they
need to be initialized for all blocks, not just block 0.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-02-16 23:39:57 +00:00
Justin Ruggles 50d7140441 ac3enc: change default floor code to 7.
This is to match the value in every (E-)AC-3 file from commercial sources.
It has a negligible effect on audio quality.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-02-15 21:40:42 +00:00
Reinhard Tartler 737eb5976f Merge libavcore into libavutil
It is pretty hopeless that other considerable projects will adopt
libavutil alone in other projects. Projects that need small footprint
are better off with more specialized libraries such as gnulib or rather
just copy the necessary parts that they need. With this in mind, nobody
is helped by having libavutil and libavcore split. In order to ease
maintenance inside and around FFmpeg and to reduce confusion where to
put common code, avcore's functionality is merged (back) to avutil.

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2011-02-15 16:18:21 +01:00
Justin Ruggles dda3f0ef48 Add x86-optimized versions of exponent_min().
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-10 15:32:47 -05:00
Justin Ruggles c3beafa0f1 ac3enc: Change EXP_DIFF_THRESHOLD to 500.
This patch changes the exponent difference threshold in the exponent
strategy decision function of the AC-3 encoder.  I tested lowering in
increments of 100.  From 1000 down to 500 generally increased in quality
with each step, but 400 was generally much worse.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-02-02 20:00:43 +00:00
Justin Ruggles 4c57cde942 Add ff_ prefix to ac3_common_init().
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-26 15:35:27 +00:00
Justin Ruggles 3b924294ea ac3enc: use dsputil functions in apply_window()
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-22 17:53:28 +00:00
Justin Ruggles 0db5d2b09e cosmetics: spacing, line wrap, and remove unneeded braces
Originally committed as revision 26359 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-15 01:59:31 +00:00
Justin Ruggles 964f2cf2a0 Process all EXP_REUSE blocks at once in exponent_min().
43% faster in function encode_exponents().

Originally committed as revision 26358 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-15 01:59:21 +00:00
Justin Ruggles 7d87d56ff8 Take advantage of per-channel exponent and exponent strategy layout to
simplify and speed up encode_exponents().
8% faster in function.

Originally committed as revision 26357 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-15 01:59:15 +00:00
Justin Ruggles 5bff8590f3 Simplify compute_exp_strategy() by passing a pointer to all exponents and
exponent strategies for a single channel to compute_exp_strategy_ch().
This allows for removal of the temporary pointer arrays.

Originally committed as revision 26356 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-15 01:59:10 +00:00
Justin Ruggles 4b90c35d74 Use a local variable in the inner loop of group_exponents() to simplify the
code.

Originally committed as revision 26355 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-15 01:59:04 +00:00
Justin Ruggles a281c6509f cosmetics: remove unneeded braces
Originally committed as revision 26354 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-15 01:58:59 +00:00
Justin Ruggles 5fc2e0075d cosmetics: rename block_num to blk for variable name consistency
Originally committed as revision 26353 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-15 01:58:55 +00:00
Justin Ruggles 0429e4a6ca Move exp_strategy from AC3Block to AC3EncodeContext in order to arrange by
channel first, then by block.

Originally committed as revision 26352 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-15 01:58:50 +00:00
Justin Ruggles 7cc4be58b4 Rearrange exponent buffer to group all blocks for a single channel together.
This will allow for faster and simpler processing of all blocks at once.

Originally committed as revision 26351 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-15 01:58:45 +00:00
Justin Ruggles dc7e07ac1f Add stereo rematrixing support to the AC-3 encoders.
This improves the audio quality significantly for stereo source with both the
fixed-point and floating-point AC-3 encoders.
Update acodec-ac3_fixed and seek-ac3_rm test references.

Originally committed as revision 26271 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-08 23:21:17 +00:00
Justin Ruggles ac05f9030e Convert floating-point MDCT coefficients to 24-bit fixed-point all at once
instead of doing it separately in 2 different functions.
This makes float AC-3 encoding approx. 3-7% faster overall.
Also, the coefficient conversion can now be easily SIMD-optimized.

Originally committed as revision 26232 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-05 20:35:36 +00:00
Justin Ruggles 9be52d48d9 Use local variables outside the inner loop in extract_exponents() to reduce
accessing of structs and arrays inside the loop.
Approx. 30% faster in function extract_exponents().

Originally committed as revision 26226 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-05 16:02:08 +00:00
Justin Ruggles f1cbbb79bf cosmetics: fix typo in previous commit
Originally committed as revision 26210 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-04 12:08:10 +00:00
Justin Ruggles 6fd96d1a85 Change the AC-3 encoder to use floating-point.
Fixed-point AC-3 encoder renamed to ac3_fixed.
Regression test acodec-ac3 renamed to acodec-ac3_fixed.
Regression test lavf-rm changed to use ac3_fixed encoder.

Originally committed as revision 26209 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-04 11:53:44 +00:00
Justin Ruggles ad6b2c1f6d Move fixed-point parts of the AC-3 encoder to separate files.
Originally committed as revision 26206 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-03 16:08:56 +00:00