David's Wikiblog

 

Lundi, 3. Octobre 2016

 

Dr.Dobb's articles by Herb Sutter :

Dr.Dobb's articles by Andrei Alexandrescu :

Articles by Bartosz Milewski :

Theoretical papers :

others :

libraries :

forums / news / blogs

Voir les commentaires...

Mardi, 16. Juin 2015

 

Paxos :

Raft :

Voir les commentaires...

Mercredi, 14. Janvier 2015

 

Le truc pas cool avec un telephone portable, c'est que l'on fait moins de photos avec un vrai appareil photo, vu qu'on en a toujours un sous la main :-(

Vignettes

Contenu de la gallerie

Photos

Contenu de la gallerie

Voir les commentaires... 

Vacances au ski. Pas beaucoup de photos, je me suis bloque le dos le 2eme jour :-(

vignettes

Contenu de la gallerie

Gros format

Contenu de la gallerie

Voir les commentaires... 

Petit week-end super court a Londres en amoureux.

Vignettes

Contenu de la gallerie

Gros format

Contenu de la gallerie

Voir les commentaires... 

Photos de vacances dans les alpes a Var.

Petites photos

Contenu de la gallerie

Grosses photos

Contenu de la gallerie

Voir les commentaires...

Mercredi, 5. Novembre 2014

 

Perf/profiling links :

Voir les commentaires...

Vendredi, 19. Septembre 2014

 

2 articles to refresh our brain's memory about computer memory accesses

Voir les commentaires...

Mercredi, 15. Janvier 2014

 

Others A high perf blog on linux.

Voir les commentaires... 

Debugging latency under linux

Voir les commentaires...

Jeudi, 14. Novembre 2013

 

Purpose

Quick howto to build tvheadend with rtsp support on qnap.
The goal is to have the freebox channel available from within xbmc on another host (my media center).

get tvheadend sources and merge in the rtsp branch from glandos

 git clone https://github.com/tvheadend/tvheadend.git
 git remote add glandos https://github.com/Glandos/tvheadend.git
 git merge glandos/iptv_rtsp

Patch the sources so it compiles on qnap

Edit src/iptv_input_rtsp.c to add

 #define __USE_GNU

on the very first line

Edit src/atomic.h replace

 static inline int
 atomic_add(volatile int *ptr, int incr)
 {
 #if ENABLE_ATOMIC64
   return __sync_fetch_and_add(ptr, incr);
 #else
   int r;
   pthread_mutex_lock(&atomic_lock);
   r = *ptr;
   *ptr += incr;
   pthread_mutex_unlock(&atomic_lock);
   return r;
 #endif
 }
 static inline int
 atomic_exchange(volatile int *ptr, int new)
 {
 #if ENABLE_ATOMIC64
   return  __sync_lock_test_and_set(ptr, new);
 #else
   int r;
   pthread_mutex_lock(&atomic_lock);
   r = *ptr;
   *ptr = new;
   pthread_mutex_unlock(&atomic_lock);
   return r;
 #endif
 }

The problem is there is no support for atomics on qnap. The quick fix is to use the existing lock used for 64bits cas operation. Not entirely clean (should create a dedicated compile option), but works.

install build env on qnap

 sudo -u admin ipkg install gcc automake pkg-config make pkgconfig openssl-dev libcurl-dev avahi

get and build ffmpeg

Need to build ffmpeg by hand

DO NOT (see below) git clone git://git.videolan.org/ffmpeg.git

Actually needs libavcodec <= 55.0.0 so get release 1.2.4 from http://www.ffmpeg.org/releases/ffmpeg-1.2.4.tar.bz2 (libavcodec 54. 92.100)

 ./configure --prefix=/opt --disable-neon
 make -j2

what about libaacplus and libx264 support ? Not needed for now. See this

What about ogg/vorbis ? vpx ? See this

get and build zlib

download from http://www.zlib.net/

 ./configure --prefix=/opt
 make -j2
 sudo -u admin make install

fix curl

Edit pkgconfig's libcurl entry

 sudo -u admin vi /opt/lib/pkgconfig/libcurl.pc

comment out the URL line

build tvheadend

 CC=/opt/bin/gcc ./configure --prefix=/opt
 make -j2

patch the qpkg install of tvheadend previously installed

qpkg package available from here.

  • Rename /opt/MD0_DATA/.qpkg/TVHeadend/bin/tvheadend to tvheadend.orig
  • Copy build.linux/tvheadend into /opt/MD0_DATA/.qpkg/TVHeadend/bin/
  • Copy build.linux/src into /opt/MD0_DATA/.qpkg/TVHeadend/
  • Copy ../src/webui/static into /opt/MD0_DATA/.qpkg/TVHeadend/src/webui

tweak the launch script TVHeadend.sh

  • Comment launching the binary with newest libc (from qpkg's install)
  • Add LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/lib on the launch command line (because of openssl)

See also installation instructions for glandos

Automatically upload freebox's m3u channel to tvheadend

Get script m3u_to_tv.py from https://github.com/Glandos/m3u_to_tv

 python m3u_to_tv.py --backend-host=your_host --backend-port=9981

Enjoy watching and recording freebox shows from xbmc !

Voir les commentaires...

Vendredi, 28. Juin 2013

 

Quelques photos du spectacle

vignette

Contenu de la gallerie

photos

Contenu de la gallerie

Voir les commentaires... 

List of papers found about floating point hacks

One weird thing is that some of those tricks work for x>1, but not for x in [0, 1[.

Tested between [0, 1[

invsqrt

With the following code

 float myinvsqrt(float x)
 {
   union {float f; uint32_t u;} y;
 //   float xhalf = 0.5f * x;
   y.f = x;
   y.u = 0x5f3759df - (y.u >> 1);
 //   y.f = y.f*(1.5f-(xhalf*y.f*y.f));
   return y.f;
 }

I even removed the newton correction ! Here's the graph : inv sqrt approx

Pretty accurate, that one works !

log2

With the following code

 float mylog2(float x)
 {
   union {float f; uint32_t u;} y;
   y.f = x;
   return y.u / 8388608.0 - 127;
 }

Here's the graph : log2 approx

Pretty accurate, that one works !

exp2

With the following code

 float myexp2(float x)
 {
   union {float f; uint32_t u;} y;
   y.u = (x + 127) * 8388608;
   return y.f;
 }

Here's the graph : exp2 approx

Not very accurate, don't know if that works better for x>1.

pow(a, b)

By combining log2 and exp2, we can create an estimate of pow like this :

 float pow(float a, float b)
 {
   union {float f; uint32_t u;} y;
   y.f = a;
   y.u = y.u * b - 127 * (b - 1) * 8388608;
   return y.f;
 }

Example with b = 8.125

pow(x, 8.125) approx

mmmm... not very good. Needs a Newton-Raphson iteration. By adding a single iteration

 y.f = y.f * ((1-8.125) + 8.125 * x * powf(y.f, -1.f/8.125f));

This gives this graph : pow(x, 8.125) approx with newton

So better, only problem, I need powf for the newton iteration... So this is work in progress, hope to find a solution soon.

pow(x, -1/8)

I was able to derive the -1/8 power, here it is

 float mypowm0_125(float x)
 {
   union {float f; uint32_t u;} y;
   y.f = x;
   y.u = 0x476983e4 - (y.u >> 3);
   return y.f;
 }

Here's the graph : -1/8 approx

That one needs a newton iteration to correct for the error.

Voir les commentaires...

Mardi, 14. Mai 2013

 

vignettes

Contenu de la gallerie

photos

Contenu de la gallerie

Voir les commentaires... 

vignettes

Contenu de la gallerie

photos

Contenu de la gallerie

Voir les commentaires... 

Ski (vignettes)

Contenu de la gallerie

Ski (grandes)

Contenu de la gallerie

Voir les commentaires... 

Tchoupi passe un week end a la maison avant de retourner a l'ecole.

vignettes

Contenu de la gallerie

photos

Contenu de la gallerie

Voir les commentaires... 

vignettes

Contenu de la gallerie

photos

Contenu de la gallerie

Voir les commentaires... 

vignettes

Contenu de la gallerie

photos

Contenu de la gallerie

Voir les commentaires... 

vignettes

Contenu de la gallerie

photos

Contenu de la gallerie

Voir les commentaires...
Toutes les photos et textes sous license Creative Commons by-nc-sa par Nancy Gauthier et David Jobet