1. 16 Apr, 2019 1 commit
  2. 26 Sep, 2018 1 commit
  3. 20 Jul, 2018 1 commit
  4. 17 Oct, 2015 1 commit
    • Rostislav Pehlivanov's avatar
      aacenc_tns: rework TNS descision logic · fa4d900c
      Rostislav Pehlivanov authored
      Changes:
       - strongly prefer dual filters to a single filter
       - less strict about using 2 filters w.r.t. energy
       - scrap the usage of threshold and spread, useless
       - use odd-shaped windows to set the filter direction
       - use 4 bits instead of 3 bits for short windows
       - simplify and reduce the main loop to a single level
       - add stricter regulations for short windows
      
      All of this now makes the TNS implementation operate
      as good as it can and it definitely shows. The frequency
      thresholds are now even better defined by looking at
      the spectrals and the overall sound has been improved at
      the price of just a few bits that are well worth it.
      fa4d900c
  5. 12 Sep, 2015 2 commits
    • Rostislav Pehlivanov's avatar
      aacenc_tns: readjust values for new TNS decision making · 3381d926
      Rostislav Pehlivanov authored
      Since TNS was fixed with the recent commits retweak the values
      so it's more frequently used.
      Still not enabled by default yet, though it's possible that it
      will be made enabled by default in the near future.
      Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
      3381d926
    • Rostislav Pehlivanov's avatar
      aacenc_tns: redo coefficient quantization and decision making · a83a8d70
      Rostislav Pehlivanov authored
      This finally (and again) gets rid of basically everything the
      specifications say about how TNS should be done. The main
      problem used to be that a single filter was used for all
      coefficients which despite being explicitly recommended by
      the specifications usually sounds wrong, therefore it's
      a corner case in the current TNS implementation.
      
      This commit also changes the coefficient bit size, as apparently
      it's better to use lower precision in case the windows are eight
      short. This is apparently what fdk_aac uses, looking at the bit
      stream and makes sense. Also the order when 8 SHORT windows happen
      is important as 7 was too much and according to PSNR was worse
      while 5 is just about correct.
      Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
      a83a8d70
  6. 05 Sep, 2015 1 commit
    • Rostislav Pehlivanov's avatar
      aacenc_tns: adjust coefficient calculation, add double filter support · e3faad81
      Rostislav Pehlivanov authored
      This commit improves the TNS implementation to the point where it's
      actually usable and very rarely results in nastyness (in all bitrates
      except extremely low bitrates it's increasing the quality and prevents
      some distortions from the coder being audiable).
      
      Also adds a double filter support which is only used if the energy
      difference between the top and bottom of the SFBs is above the
      thresholds defined in the header file. Looking at the bitstream
      that fdk_aac generates it sometimes used a double filter despite
      the specs stating that a single filter should be enough for almost
      all cases and purposes.
      
      Unlike FAAC or fdk_aac we sometimes use a reverse filter in case
      the energy difference isn't enought to use a double filter. This
      actually works better.
      Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
      e3faad81
  7. 01 Sep, 2015 1 commit
    • Rostislav Pehlivanov's avatar
      aacenc_tns: rework coefficient quantization and filter application · f3f6c6b9
      Rostislav Pehlivanov authored
      This commit reworks the TNS implementation to a hybrid between what
      the specifications say, what the decoder does and what's the best
      thing to do.
      
      The filter application function was copied from the decoder and
      modified such that it applies the inverse AR filter to the
      coefficients. The LPC coefficients themselves are fed into the
      same quantization expression that the specifications say should
      be used however further processing is not done, instead they're
      converted to the form that the decoder expects them to be in
      and are sent off to the compute_lpc_coeffs function exactly the
      way the decoder does. This function does all conversions and will
      return the exact coefficients that the decoder will generate, which
      are then applied to the coefficients.
      Having the exact same coefficients on both the encoder and decoder
      is a must since otherwise the entire sfb's over which the filter
      is applied will be attenuated.
      
      Despite this major rework, TNS might not work fine on some audio
      types at very low bitrates (e.g. sub 90kbps) as it can attenuate
      some coefficients too much. Users are advised to experiment with
      TNS at higher bitrates if they wish to use this tool or simply
      wait for the implementation to be improved.
      Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
      f3f6c6b9
  8. 29 Aug, 2015 1 commit
    • Rostislav Pehlivanov's avatar
      aacenc_tns: rework the way coefficients are calculated · f20b6717
      Rostislav Pehlivanov authored
      This commit abandons the way the specifications state to
      quantize the coefficients, makes use of the new LPC float
      functions and is much better.
      
      The original way of converting non-normalized float samples
      to int32_t which out LPC system expects was wrong and it was
      wrong to assume the coefficients that are generated are also
      valid. It was essentially a full garbage-in, garbage-out
      system and it definitely shows when looking at spectrals
      and listening. The high frequencies were very overattenuated.
      The new LPC function performs the analysis directly.
      
      The specifications state to quantize the coefficients into
      four bit index values using an asin() function which of course
      had to have ugly ternary operators because the function turns
      negative if the coefficients are negative which when encoding
      causes invalid bitstream to get generated.
      
      This deviates from this by using the direct TNS tables, which
      are fairly small since you only have 4 bits at most for index
      values. The LPC values are directly quantized against the tables
      and are then used to perform filtering after the requantization,
      which simply fetches the array values.
      
      The end result is that TNS works much better now and doesn't
      attenuate anything but the actual signal, e.g. TNS removes
      quantization errors and does it's job correctly now.
      
      It might be enabled by default soon since it doesn't hurt and
      helps reduce nastyness at low bitrates.
      Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
      f20b6717
  9. 22 Aug, 2015 2 commits
  10. 21 Aug, 2015 1 commit
    • Rostislav Pehlivanov's avatar
      aacenc_tns: implement temporal noise shaping · a1c487e9
      Rostislav Pehlivanov authored
      This commit implements temporal noise shaping support in the
      encoder, along with an -aac_tns option to toggle it on or off
      (off by default for now). TNS will increase audio quality
      and reduce quantization noise by applying a multitap FIR filter
      across allowed coefficients and transmit side information to the
      decoder so it could create an inverse filter.
      
      Users are encouraged to test the new functionality by enabling
      -aac_tns 1 during encoding.
      
      No major bugs are observable at this time so after a while if no
      new problems appear and if the current implementation is deemed
      of high enough quality and stability it will be enabled by default,
      possibly at the same time the encoder has its experimental flag
      removed and becomes the standard aac encoder in ffmpeg.
      Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
      a1c487e9
  11. 18 Oct, 2012 1 commit
    • Martin Storsjö's avatar
      Add support for building shared libraries with MSVC · d66c52c2
      Martin Storsjö authored
      This requires the makedef perl script by Derek, from the
      c89-to-c99 repo. That scripts produces a .def file, listing
      the symbols to be exported, based on the gcc version scripts
      and the built object files.
      
      To properly load non-function symbols from DLL files, the
      data symbol declarations need to have the attribute
      __declspec(dllimport) when building the calling code. (On mingw,
      the linker can fix this up automatically, which is why it has not
      been an issue so far. If this attribute is omitted, linking
      actually succeeds, but reads from the table will not produce the
      desired results at runtime.)
      
      MSVC seems to manage to link DLLs (and run properly) even if
      this attribute is present while building the library itself
      (which normally isn't recommended) - other object files in the
      same library manage to link to the symbol (with a small warning
      at link time, like "warning LNK4049: locally defined symbol
      _avpriv_mpa_bitrate_tab imported" - it doesn't seem to be possible
      to squelch this warning), and the definition of the tables
      themselves produce a warning that can be squelched ("warning C4273:
      'avpriv_mpa_bitrate_tab' : inconsistent dll linkage, see previous
      definition of 'avpriv_mpa_bitrate_tab').
      
      In this setup, mingw isn't able to link object files that refer to
      data symbols with __declspec(dllimport) without those symbols
      actually being linked via a DLL (linking avcodec.dll ends up with
      errors like "undefined reference to `__imp__avpriv_mpa_freq_tab'").
      The dllimport declspec isn't needed at all in mingw, so we simply
      choose not to declare it for other compilers than MSVC that requires
      it. (If ICL support later requires it, the condition can be extended
      later to include both of them.)
      
      This also implies that code that is built to link to a certain
      library as a DLL can't link to the same library as a static library.
      Therefore, we only allow building either static or shared but not
      both at the same time. (That is, static libraries as such can be,
      and actually are, built - this is used for linking the test tools to
      internal symbols in the libraries - but e.g. libavformat built to
      link to libavcodec as a DLL cannot link statically to libavcodec.)
      
      Also, linking to DLLs is slightly different from linking to shared
      libraries on other platforms. DLLs use a thing called import
      libraries, which is basically a stub library allowing the linker
      to know which symbols exist in the DLL and what name the DLL will
      have at runtime.
      
      In mingw/gcc, the import library is usually named libfoo.dll.a,
      which goes next to a static library named libfoo.a. This allows
      gcc to pick the dynamic one, if available, from the normal -lfoo
      switches, just as it does for libfoo.a vs libfoo.so on Unix. On
      MSVC however, you need to literally specify the name of the import
      library instead of the static library.
      Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
      d66c52c2
  12. 24 Aug, 2012 1 commit
  13. 20 Oct, 2011 1 commit
  14. 20 May, 2011 1 commit
  15. 19 Mar, 2011 1 commit
  16. 20 Apr, 2010 1 commit
  17. 01 Feb, 2009 1 commit
  18. 31 Aug, 2008 1 commit
  19. 24 Jun, 2008 1 commit
  20. 09 May, 2008 1 commit
  21. 08 Nov, 2007 1 commit
  22. 17 Oct, 2007 1 commit
  23. 19 May, 2007 2 commits
  24. 27 Feb, 2007 1 commit
  25. 25 Jul, 2002 1 commit