[FFmpeg-devel] [PATCH 02/15] libavutil: Implementation of AAC_fixed_decoder (LC-module) [2/5]

Michael Niedermayer michaelni at gmx.at
Sat Nov 8 15:02:32 CET 2014


On Fri, Nov 07, 2014 at 04:08:06PM +0100, Nedeljko Babic wrote:
> From: Djordje Pesut <djordje.pesut at imgtec.com>
> 
> Make changes in softfloat.
> 
> Functions for sqrt and sincos are added.
> 
> Div function is improved.
> 
> Some changes are made in order for code in softfloat to be usable in fixed aac
> decoder code.
> For example order of fields in structure SoftFloat is changed.
> This doesn't create any impact on current ffmpeg code since softfloat is
> currently not in use and this way we don't need to make much changes in
> implementation of aac fixed point decoder that uses this code.
> 
> Signed-off-by: Nedeljko Babic <nedeljko.babic at imgtec.com>
> ---
>  libavutil/softfloat.h        | 167 ++++++++++++++++++++----
>  libavutil/softfloat_tables.h | 294 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 439 insertions(+), 22 deletions(-)
>  create mode 100644 libavutil/softfloat_tables.h
> 
> diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
> index 8647e6a..df91a8b 100644
> --- a/libavutil/softfloat.h
> +++ b/libavutil/softfloat.h
> @@ -23,18 +23,26 @@
>  
>  #include <stdint.h>
>  #include "common.h"
> -
>  #include "avassert.h"
> +#include "softfloat_tables.h"
>  
>  #define MIN_EXP -126
>  #define MAX_EXP  126
>  #define ONE_BITS 29
>  
>  typedef struct SoftFloat{
> -    int32_t  exp;
>      int32_t mant;
> +    int32_t  exp;
>  }SoftFloat;
>  

> +static const SoftFloat FLOAT_0          = {         0,   0};
> +static const SoftFloat FLOAT_05         = { 536870912,   0};
> +static const SoftFloat FLOAT_1          = { 536870912,   1};
> +static const SoftFloat FLOAT_EPSILON    = { 703687442, -16};
> +static const SoftFloat FLOAT_1584893192 = { 850883053,   1};
> +static const SoftFloat FLOAT_100000     = { 819200000,  17};
> +static const SoftFloat FLOAT_0999999    = {1073740750,   0};

the mantises should be in some form of base 2 or base 16 in the
source as this should be more readable


> +
>  static av_const SoftFloat av_normalize_sf(SoftFloat a){
>      if(a.mant){
>  #if 1
> @@ -66,11 +74,12 @@ static inline av_const SoftFloat av_normalize1_sf(SoftFloat a){
>      av_assert2(a.mant < 0x40000000 && a.mant > -0x40000000);
>      return a;
>  #elif 1
> -    int t= a.mant + 0x40000000 < 0;
> -    return (SoftFloat){a.exp+t, a.mant>>t};
> +    int t= a.mant + 0x40000000;
> +    t = t < 0;
> +    return (SoftFloat){ a.mant>>t, a.exp+t};
>  #else
>      int t= (a.mant + 0x40000000U)>>31;

> -    return (SoftFloat){a.exp+t, a.mant>>t};
> +    return (SoftFloat){a.mant>>t, a.exp+t};

fliping the order of the argumets, as its cosmetic should be in a
seperate patch from all functional changes
this keeps the changes easier to read now for review as well as in
the future

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141108/9e7ce308/attachment.asc>


More information about the ffmpeg-devel mailing list