Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (46)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

  • Taille des images et des logos définissables

    9 février 2011, par

    Dans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
    Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...)

Sur d’autres sites (6720)

  • Beware the builtins

    14 janvier 2010, par Mans — Compilers

    GCC includes a large number of builtin functions allegedly providing optimised code for common operations not easily expressed directly in C. Rather than taking such claims at face value (this is GCC after all), I decided to conduct a small investigation to see how well a few of these functions are actually implemented for various targets.

    For my test, I selected the following functions :

    • __builtin_bswap32 : Byte-swap a 32-bit word.
    • __builtin_bswap64 : Byte-swap a 64-bit word.
    • __builtin_clz : Count leading zeros in a word.
    • __builtin_ctz : Count trailing zeros in a word.
    • __builtin_prefetch : Prefetch data into cache.

    To test the quality of these builtins, I wrapped each in a normal function, then compiled the code for these targets :

    • ARMv7
    • AVR32
    • MIPS
    • MIPS64
    • PowerPC
    • PowerPC64
    • x86
    • x86_64

    In all cases I used compiler flags were -O3 -fomit-frame-pointer plus any flags required to select a modern CPU model.

    ARM

    Both __builtin_clz and __builtin_prefetch generate the expected CLZ and PLD instructions respectively. The code for __builtin_ctz is reasonable for ARMv6 and earlier :

    rsb     r3, r0, #0
    and     r0, r3, r0
    clz     r0, r0
    rsb     r0, r0, #31
    

    For ARMv7 (in fact v6T2), however, using the new bit-reversal instruction would have been better :

    rbit    r0, r0
    clz     r0, r0
    

    I suspect this is simply a matter of the function not yet having been updated for ARMv7, which is perhaps even excusable given the relatively rare use cases for it.

    The byte-reversal functions are where it gets shocking. Rather than use the REV instruction found from ARMv6 on, both of them generate external calls to __bswapsi2 and __bswapdi2 in libgcc, which is plain C code :

    SItype
    __bswapsi2 (SItype u)
    
      return ((((u) & 0xff000000) >> 24)
              | (((u) & 0x00ff0000) >>  8)
              | (((u) & 0x0000ff00) <<  8)
              | (((u) & 0x000000ff) << 24)) ;
    
    

    DItype
    __bswapdi2 (DItype u)

    return ((((u) & 0xff00000000000000ull) >> 56)
    | (((u) & 0x00ff000000000000ull) >> 40)
    | (((u) & 0x0000ff0000000000ull) >> 24)
    | (((u) & 0x000000ff00000000ull) >> 8)
    | (((u) & 0x00000000ff000000ull) << 8)
    | (((u) & 0x0000000000ff0000ull) << 24)
    | (((u) & 0x000000000000ff00ull) << 40)
    | (((u) & 0x00000000000000ffull) << 56)) ;

    While the 32-bit version compiles to a reasonable-looking shift/mask/or job, the 64-bit one is a real WTF. Brace yourselves :

    push    r4, r5, r6, r7, r8, r9, sl, fp
    mov     r5, #0
    mov     r6, #65280 ; 0xff00
    sub     sp, sp, #40 ; 0x28
    and     r7, r0, r5
    and     r8, r1, r6
    str     r7, [sp, #8]
    str     r8, [sp, #12]
    mov     r9, #0
    mov     r4, r1
    and     r5, r0, r9
    mov     sl, #255 ; 0xff
    ldr     r9, [sp, #8]
    and     r6, r4, sl
    mov     ip, #16711680 ; 0xff0000
    str     r5, [sp, #16]
    str     r6, [sp, #20]
    lsl     r2, r0, #24
    and     ip, ip, r1
    lsr     r7, r4, #24
    mov     r1, #0
    lsr     r5, r9, #24
    mov     sl, #0
    mov     r9, #-16777216 ; 0xff000000
    and     fp, r0, r9
    lsr     r6, ip, #8
    orr     r9, r7, r1
    and     ip, r4, sl
    orr     sl, r1, r2
    str     r6, [sp]
    str     r9, [sp, #32]
    str     sl, [sp, #36] ; 0x24
    add     r8, sp, #32
    ldm     r8, r7, r8
    str     r1, [sp, #4]
    ldm     sp, r9, sl
    orr     r7, r7, r9
    orr     r8, r8, sl
    str     r7, [sp, #32]
    str     r8, [sp, #36] ; 0x24
    mov     r3, r0
    mov     r7, #16711680 ; 0xff0000
    mov     r8, #0
    and     r9, r3, r7
    and     sl, r4, r8
    ldr     r0, [sp, #16]
    str     fp, [sp, #24]
    str     ip, [sp, #28]
    stm     sp, r9, sl
    ldr     r7, [sp, #20]
    ldr     sl, [sp, #12]
    ldr     fp, [sp, #12]
    ldr     r8, [sp, #28]
    lsr     r0, r0, #8
    orr     r7, r0, r7, lsl #24
    lsr     r6, sl, #24
    orr     r5, r5, fp, lsl #8
    lsl     sl, r8, #8
    mov     fp, r7
    add     r8, sp, #32
    ldm     r8, r7, r8
    orr     r6, r6, r8
    ldr     r8, [sp, #20]
    ldr     r0, [sp, #24]
    orr     r5, r5, r7
    lsr     r8, r8, #8
    orr     sl, sl, r0, lsr #24
    mov     ip, r8
    ldr     r0, [sp, #4]
    orr     fp, fp, r5
    ldr     r5, [sp, #24]
    orr     ip, ip, r6
    ldr     r6, [sp]
    lsl     r9, r5, #8
    lsl     r8, r0, #24
    orr     fp, fp, r9
    lsl     r3, r3, #8
    orr     r8, r8, r6, lsr #8
    orr     ip, ip, sl
    lsl     r7, r6, #24
    and     r5, r3, #16711680 ; 0xff0000
    orr     r7, r7, fp
    orr     r8, r8, ip
    orr     r4, r1, r7
    orr     r5, r5, r8
    mov     r9, r6
    mov     r1, r5
    mov     r0, r4
    add     sp, sp, #40 ; 0x28
    pop     r4, r5, r6, r7, r8, r9, sl, fp
    bx      lr
    

    That’s right, 91 instructions to move 8 bytes around a bit. GCC definitely has a problem with 64-bit numbers. It is perhaps worth noting that the bswap_64 macro in glibc splits the 64-bit value into 32-bit halves which are then reversed independently, thus side-stepping this weakness of gcc.

    As a side note, ARM RVCT (armcc) compiles those functions perfectly into one and two REV instructions, respectively.

    AVR32

    There is not much to report here. The latest gcc version available is 4.2.4, which doesn’t appear to have the bswap functions. The other three are handled nicely, even using a bit-reverse for __builtin_ctz.

    MIPS / MIPS64

    The situation MIPS is similar to ARM. Both bswap builtins result in external libgcc calls, the rest giving sensible code.

    PowerPC

    I scarcely believe my eyes, but this one is actually not bad. The PowerPC has no byte-reversal instructions, yet someone seems to have taken the time to teach gcc a good instruction sequence for this operation. The PowerPC does have some powerful rotate-and-mask instructions which come in handy here. First the 32-bit version :

    rotlwi  r0,r3,8
    rlwimi  r0,r3,24,0,7
    rlwimi  r0,r3,24,16,23
    mr      r3,r0
    blr
    

    The 64-bit byte-reversal simply applies the above code on each half of the value :

    rotlwi  r0,r3,8
    rlwimi  r0,r3,24,0,7
    rlwimi  r0,r3,24,16,23
    rotlwi  r3,r4,8
    rlwimi  r3,r4,24,0,7
    rlwimi  r3,r4,24,16,23
    mr      r4,r0
    blr
    

    Although I haven’t analysed that code carefully, it looks pretty good.

    PowerPC64

    Doing 64-bit operations is easier on a 64-bit CPU, right ? For you and me perhaps, but not for gcc. Here __builtin_bswap64 gives us the now familiar __bswapdi2 call, and while not as bad as the ARM version, it is not pretty :

    rldicr  r0,r3,8,55
    rldicr  r10,r3,56,7
    rldicr  r0,r0,56,15
    rldicl  r11,r3,8,56
    rldicr  r9,r3,16,47
    or      r11,r10,r11
    rldicr  r9,r9,48,23
    rldicl  r10,r0,24,40
    rldicr  r0,r3,24,39
    or      r11,r11,r10
    rldicl  r9,r9,40,24
    rldicr  r0,r0,40,31
    or      r9,r11,r9
    rlwinm  r10,r3,0,0,7
    rldicl  r0,r0,56,8
    or      r0,r9,r0
    rldicr  r10,r10,8,55
    rlwinm  r11,r3,0,8,15
    or      r0,r0,r10
    rldicr  r11,r11,24,39
    rlwinm  r3,r3,0,16,23
    or      r0,r0,r11
    rldicr  r3,r3,40,23
    or      r3,r0,r3
    blr
    

    That is 6 times longer than the (presumably) hand-written 32-bit version.

    x86 / x86_64

    As one might expect, results on x86 are good. All the tested functions use the available special instructions. One word of caution though : the bit-counting instructions are very slow on some implementations, specifically the Atom, AMD chips, and the notoriously slow Pentium4E.

    Conclusion

    In conclusion, I would say gcc builtins can be useful to avoid fragile inline assembler. Before using them, however, one should make sure they are not in fact harmful on the required targets. Not even those builtins mapping directly to CPU instructions can be trusted.

  • Recapping WebM’s First Week

    25 mai 2010, par noreply@blogger.com (John Luther) — webm, vp8, vorbis

    The WebM project launched last Wednesday with broad industry backing (watch video of the announcement). The list of supporters keeps growing with new additions such as the popular VLC media player, Miro Video Converter, HeyWatch cloud encoding platform, and videantis programmable processor platform. We’re also happy to see that future versions of IE will support playback of VP8 when the user has installed the codec.

    Our announcement sparked discussions in the community around the design and quality of our developer release. We’ve done extensive testing of VP8 and know that the codec can match or exceed the quality of other leading codecs. Starting this week, the engineers behind WebM will post frequently to this blog with details on how to make optimal use of its VP8 video codec and Vorbis audio codec. We are confident that the open development model will bring additional improvements that will further optimize WebM. In fact, the power of open development is already visible, with developers submitting patches and the folks at Flumotion enabling live streaming support in their product just three days after the project was launched.

    Keep an eye on this blog for regular updates on the adoption and development of WebM. To participate in the conversation or to ask questions of the WebM team, please join our discussion group.

    John Luther
    Product Manager, Google

  • FFMPEG(?) Error : [out#0/s16le @ 000002452f906a00] Output file does not contain any stream

    11 mars 2024, par Ondosh
    FFMPEG_OPTIONS = {&#xA;    &#x27;before_options&#x27;: &#x27;-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5&#x27;,&#xA;    &#x27;options&#x27;: &#x27;-vn&#x27;}&#xA;YDL_OPTIONS = {&#xA;    &#x27;format&#x27;: &#x27;bestaudio/best&#x27;,&#xA;    &#x27;extractaudio&#x27;: True,&#xA;    &#x27;noplaylist&#x27;: True,&#xA;    &#x27;simulate&#x27;: &#x27;True&#x27;,&#xA;    &#x27;preferredquality&#x27;: &#x27;192&#x27;,&#xA;    &#x27;preferredcodec&#x27;: &#x27;mp3&#x27;,&#xA;    &#x27;key&#x27;: &#x27;FFmpegExtractAudio&#x27;}&#xA;@bot.command(aliases=[&#x27;Ping&#x27;, &#x27;PING&#x27;, &#x27;Пинг&#x27;, &#x27;ПИНГ&#x27;, &#x27;зштп&#x27;, &#x27;ЗШТП&#x27;, &#x27;Зштп&#x27;,&#xA;                      &#x27;пинг&#x27;])&#xA;async def ping(ctx):&#xA;    await ctx.message.reply(f&#x27;Ping: {round(bot.latency * 1000)}ms&#x27;)&#xA;#########################[PLAY MUSIC BLOCK]#########################&#xA;@bot.command()&#xA;async def add(ctx, *url):&#xA;    url = &#x27; &#x27;.join(url)&#xA;    with yt_dlp.YoutubeDL(YDL_OPTIONS) as ydl:&#xA;        try:&#xA;            info = ydl.extract_info(url, download=False)&#xA;        except:&#xA;            info = ydl.extract_info(f"ytsearch:{url}",&#xA;                                    download=False)[&#x27;entries&#x27;][0]&#xA;&#xA;    URL = info[&#x27;formats&#x27;][0][&#x27;url&#x27;]&#xA;    name = info[&#x27;title&#x27;]&#xA;    time = str(datetime.timedelta(seconds=info[&#x27;duration&#x27;]))&#xA;    songs_queue.q_add([name, time, URL])&#xA;    embed = nextcord.Embed(description=f&#x27;Записываю [{name}]({url}) в очередь &#128221;&#x27;,&#xA;                           colour=nextcord.Colour.red())&#xA;    await ctx.message.reply(embed=embed)&#xA;def step_and_remove(voice_client):&#xA;    if loop_flag:&#xA;        songs_queue.q_add(songs_queue.get_value()[0])&#xA;    songs_queue.q_remove()&#xA;    audio_player_task(voice_client)&#xA;def audio_player_task(voice_client):&#xA;    if not voice_client.is_playing() and songs_queue.get_value():&#xA;        voice_client.play(nextcord.FFmpegPCMAudio(&#xA;            executable="ffmpeg\\bin\\ffmpeg.exe",&#xA;            source=songs_queue.get_value()[0][2],&#xA;            **FFMPEG_OPTIONS),&#xA;            after=lambda e: step_and_remove(voice_client))&#xA;@bot.command(aliases=[&#x27;Play&#x27;, &#x27;PLAY&#x27;, &#x27;играй&#x27;, &#x27;ИГРАЙ&#x27;, &#x27;Играй&#x27;, &#x27;сыграй&#x27;,&#xA;                      &#x27;Сыграй&#x27;, &#x27;СЫГРАЙ&#x27;, &#x27;здфн&#x27;, &#x27;Здфн&#x27;, &#x27;ЗДФН&#x27;, &#x27;p&#x27;, &#x27;P&#x27;,&#xA;                      &#x27;pl&#x27;, &#x27;PL&#x27;, &#x27;Pl&#x27;, &#x27;Плей&#x27;,&#xA;                      &#x27;ПЛЕЙ&#x27;, &#x27;плей&#x27;])&#xA;async def play(ctx, *url):&#xA;    await join(ctx)&#xA;    await add(ctx, &#x27; &#x27;.join(url))&#xA;    await ctx.message.add_reaction(emoji=&#x27;&#127928;&#x27;)&#xA;    voice_client = ctx.guild.voice_client&#xA;    audio_player_task(voice_client)&#xA;@bot.command(aliases=[&#x27;Queue&#x27;, &#x27;QUEUE&#x27;, &#x27;йгугу&#x27;, &#x27;Йгугу&#x27;, &#x27;ЙГУГУ&#x27;, &#x27;очередь&#x27;,&#xA;                      &#x27;Очередь&#x27;, &#x27;ОЧЕРЕДЬ&#x27;, &#x27;список&#x27;, &#x27;Список&#x27;, &#x27;СПИСОК&#x27;,&#xA;                      &#x27;list&#x27;, &#x27;List&#x27;, &#x27;LIST&#x27;, &#x27;дшые&#x27;, &#x27;Дшые&#x27;, &#x27;ДШЫЕ&#x27;, &#x27;Лист&#x27;,&#xA;                      &#x27;лист&#x27;, &#x27;ЛИСТ&#x27;, &#x27;песни&#x27;, &#x27;Песни&#x27;, &#x27;ПЕСНИ&#x27;, &#x27;songs&#x27;,&#xA;                      &#x27;Songs&#x27;, &#x27;SONGS&#x27;, &#x27;ыщтпы&#x27;, &#x27;ЫЩТПЫ&#x27;, &#x27;Ыщтпы&#x27;, &#x27;q&#x27;])&#xA;async def queue(ctx):&#xA;    if len(songs_queue.get_value()) > 0:&#xA;        only_names_and_time_queue = []&#xA;        for i in songs_queue.get_value():&#xA;            name = i[0]&#xA;            if len(i[0]) > 30:&#xA;                name = i[0][:30] &#x2B; &#x27;...&#x27;&#xA;            only_names_and_time_queue.append(f&#x27;&#128192; `{name:&lt;33}   {i[1]:>20}`\n&#x27;)&#xA;        c = 0&#xA;        queue_of_queues = []&#xA;        while c &lt; len(only_names_and_time_queue):&#xA;            queue_of_queues.append(only_names_and_time_queue[c:c &#x2B; 10])&#xA;            c &#x2B;= 10&#xA;&#xA;        embed = nextcord.Embed(title=f&#x27;ОЧЕРЕДЬ [LOOP: {loop_flag}]&#x27;,&#xA;                               description=&#x27;&#x27;.join(queue_of_queues[0]),&#xA;                               colour=nextcord.Colour.red())&#xA;        await ctx.send(embed=embed)&#xA;&#xA;        for i in range(1, len(queue_of_queues)):&#xA;            embed = nextcord.Embed(description=&#x27;&#x27;.join(queue_of_queues[i]),&#xA;                                   colour=nextcord.Colour.red())&#xA;            await ctx.send(embed=embed)&#xA;    else:&#xA;        await ctx.send(&#x27;Очередь пуста&#x27;)&#xA;

    &#xA;

    There is the part of my music bot in Discord, I don't really know why it doesn't work. Actually, I tried to use someone's old code, so it needs to be fixed. I have cut out the most important parts of the code, which most likely had an error.&#xA;I found other questions, but there was another errors.&#xA;After trying to start the video, I get the following errors :&#xA;[out#0/s16le @ 000002452f906a00] Output file does not contain any stream&#xA;Error opening output file pipe:1.&#xA;Error opening output files : Invalid argument

    &#xA;