Recherche avancée

Médias (91)

Autres articles (112)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (6955)

  • SDL Audio - Plays only Static Noise

    30 avril 2016, par bcpermafrost

    Im having an issue with playing audio.

    Im new to the SDL World of things so im learning from a tutorial.

    http://dranger.com/ffmpeg/tutorial03.html

    As far as audio goes, i have exactly what he put down and didnt get the result he says I should get. In the end of the lesson he specifies that the audio should play normally. However all i get is excessively loud static noise. This leads me to believe that the packets arent being read correctly. However I have no idea how to debug or look for the issue.

    Here is my main loop for parsing the packets :

    while (av_read_frame(pFormatCtx, &packet) >= 0) {

            if (packet.stream_index == videoStream) {
                avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);

                if (frameFinished){

                    AVPicture pict;

                    pict.data[0] = yPlane;
                    pict.data[1] = uPlane;
                    pict.data[2] = vPlane;
                    pict.linesize[0] = pCodecCtx->width;
                    pict.linesize[1] = uvPitch;
                    pict.linesize[2] = uvPitch;

                    sws_scale(sws_ctx,
                        pFrame->data, pFrame->linesize,
                        0, pCodecCtx->height,
                        pict.data, pict.linesize);

                    //SDL_UnlockTexture(bmp);

                    SDL_UpdateYUVTexture(bmp, 0,
                        yPlane, pCodecCtx->width,
                        uPlane, uvPitch,
                        vPlane, uvPitch);


                    SDL_RenderClear(renderer);
                    SDL_RenderCopy(renderer, bmp, NULL, NULL);
                    SDL_RenderPresent(renderer);


                    av_free_packet(&packet);


                }

            }
            else if (packet.stream_index == audioStream) {
                packet_queue_put(&audioq, &packet);

            }
            else
                av_free_packet(&packet);



            SDL_PollEvent(&event);

            switch (event.type) {
            case SDL_QUIT:
                quit = 1;
                SDL_DestroyTexture(bmp);
                SDL_DestroyRenderer(renderer);
                SDL_DestroyWindow(screen);
                SDL_Quit();
                exit(0);
                break;
            default:
                break;

            }

        }

    this is my initialization of the audio device :

    aCodecCtxOrig = pFormatCtx->streams[audioStream]->codec;
       aCodec = avcodec_find_decoder(aCodecCtxOrig->codec_id);
       if (!aCodec) {
           fprintf(stderr, "Unsupported codec!\n");
           return -1;
       }

       // Copy context
       aCodecCtx = avcodec_alloc_context3(aCodec);
       if (avcodec_copy_context(aCodecCtx, aCodecCtxOrig) != 0) {
           fprintf(stderr, "Couldn't copy codec context");
           return -1; // Error copying codec context
       }


       wanted_spec.freq = aCodecCtx->sample_rate;
       wanted_spec.format = AUDIO_U16SYS;
       wanted_spec.channels = aCodecCtx->channels;
       wanted_spec.silence = 0;
       wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
       wanted_spec.callback = audio_callback;
       wanted_spec.userdata = aCodecCtx;


       if (SDL_OpenAudio( &wanted_spec, &spec) < 0) {
           fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError());
           return -1;
       }

       avcodec_open2(aCodecCtx, aCodec, NULL);

       // audio_st = pFormatCtx->streams[index]
       packet_queue_init(&audioq);
       SDL_PauseAudio(0);

    The Call back (same as the tutorial) :|

    void audio_callback(void *userdata, Uint8 *stream, int len) {

       AVCodecContext *aCodecCtx = (AVCodecContext *)userdata;
       int len1, audio_size;

       static uint8_t audio_buf[(MAX_AUDIO_FRAME_SIZE * 3) / 2];
       static unsigned int audio_buf_size = 0;
       static unsigned int audio_buf_index = 0;

       while (len > 0) {
           if (audio_buf_index >= audio_buf_size) {
               /* We have already sent all our data; get more */
               audio_size = audio_decode_frame(aCodecCtx, audio_buf, sizeof(audio_buf));
               if (audio_size < 0) {
                   /* If error, output silence */
                   audio_buf_size = 1024; // arbitrary?
                   memset(audio_buf, 0, audio_buf_size);
               }
               else {
                   audio_buf_size = audio_size;
               }
               audio_buf_index = 0;
           }
           len1 = audio_buf_size - audio_buf_index;
           if (len1 > len)
               len1 = len;
           memcpy(stream, (uint8_t *)audio_buf + audio_buf_index, len1);
           len -= len1;
           stream += len1;
           audio_buf_index += len1;
       }
    }
  • SDL Audio - Plays only Static Noise

    19 août 2019, par bcpermafrost

    Im having an issue with playing audio.

    Im new to the SDL World of things so im learning from a tutorial.

    http://dranger.com/ffmpeg/tutorial03.html

    As far as audio goes, i have exactly what he put down and didnt get the result he says I should get. In the end of the lesson he specifies that the audio should play normally. However all i get is excessively loud static noise. This leads me to believe that the packets arent being read correctly. However I have no idea how to debug or look for the issue.

    Here is my main loop for parsing the packets :

    while (av_read_frame(pFormatCtx, &packet) >= 0) {

            if (packet.stream_index == videoStream) {
                avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);

                if (frameFinished){

                    AVPicture pict;

                    pict.data[0] = yPlane;
                    pict.data[1] = uPlane;
                    pict.data[2] = vPlane;
                    pict.linesize[0] = pCodecCtx->width;
                    pict.linesize[1] = uvPitch;
                    pict.linesize[2] = uvPitch;

                    sws_scale(sws_ctx,
                        pFrame->data, pFrame->linesize,
                        0, pCodecCtx->height,
                        pict.data, pict.linesize);

                    //SDL_UnlockTexture(bmp);

                    SDL_UpdateYUVTexture(bmp, 0,
                        yPlane, pCodecCtx->width,
                        uPlane, uvPitch,
                        vPlane, uvPitch);


                    SDL_RenderClear(renderer);
                    SDL_RenderCopy(renderer, bmp, NULL, NULL);
                    SDL_RenderPresent(renderer);


                    av_free_packet(&packet);


                }

            }
            else if (packet.stream_index == audioStream) {
                packet_queue_put(&audioq, &packet);

            }
            else
                av_free_packet(&packet);



            SDL_PollEvent(&event);

            switch (event.type) {
            case SDL_QUIT:
                quit = 1;
                SDL_DestroyTexture(bmp);
                SDL_DestroyRenderer(renderer);
                SDL_DestroyWindow(screen);
                SDL_Quit();
                exit(0);
                break;
            default:
                break;

            }

        }

    this is my initialization of the audio device :

    aCodecCtxOrig = pFormatCtx->streams[audioStream]->codec;
       aCodec = avcodec_find_decoder(aCodecCtxOrig->codec_id);
       if (!aCodec) {
           fprintf(stderr, "Unsupported codec!\n");
           return -1;
       }

       // Copy context
       aCodecCtx = avcodec_alloc_context3(aCodec);
       if (avcodec_copy_context(aCodecCtx, aCodecCtxOrig) != 0) {
           fprintf(stderr, "Couldn't copy codec context");
           return -1; // Error copying codec context
       }


       wanted_spec.freq = aCodecCtx->sample_rate;
       wanted_spec.format = AUDIO_U16SYS;
       wanted_spec.channels = aCodecCtx->channels;
       wanted_spec.silence = 0;
       wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
       wanted_spec.callback = audio_callback;
       wanted_spec.userdata = aCodecCtx;


       if (SDL_OpenAudio( &wanted_spec, &spec) < 0) {
           fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError());
           return -1;
       }

       avcodec_open2(aCodecCtx, aCodec, NULL);

       // audio_st = pFormatCtx->streams[index]
       packet_queue_init(&audioq);
       SDL_PauseAudio(0);

    The Call back (same as the tutorial) :|

    void audio_callback(void *userdata, Uint8 *stream, int len) {

       AVCodecContext *aCodecCtx = (AVCodecContext *)userdata;
       int len1, audio_size;

       static uint8_t audio_buf[(MAX_AUDIO_FRAME_SIZE * 3) / 2];
       static unsigned int audio_buf_size = 0;
       static unsigned int audio_buf_index = 0;

       while (len > 0) {
           if (audio_buf_index >= audio_buf_size) {
               /* We have already sent all our data; get more */
               audio_size = audio_decode_frame(aCodecCtx, audio_buf, sizeof(audio_buf));
               if (audio_size < 0) {
                   /* If error, output silence */
                   audio_buf_size = 1024; // arbitrary?
                   memset(audio_buf, 0, audio_buf_size);
               }
               else {
                   audio_buf_size = audio_size;
               }
               audio_buf_index = 0;
           }
           len1 = audio_buf_size - audio_buf_index;
           if (len1 > len)
               len1 = len;
           memcpy(stream, (uint8_t *)audio_buf + audio_buf_index, len1);
           len -= len1;
           stream += len1;
           audio_buf_index += len1;
       }
    }
  • lavu/tx : implement aarch64 NEON SIMD FFT

    3 février 2022, par Lynne
    lavu/tx : implement aarch64 NEON SIMD FFT
    

    The fastest fast Fourier transform in not just the west, but the world,
    now for the most popular toy ISA.

    On a high level, it follows the design of the AVX2 version closely,
    with the exception that the input is slightly less permuted as we don't have
    to do lane switching with the input on double 4pt and 8pt.

    On a low level, the lack of subadd/addsub instructions REALLY penalizes
    any attempt at writing an FFT. That single register matters a lot,
    and reloading it simply takes unacceptably long.
    In x86 land, vendors would've noticed developers need this.
    In ARM land, you get a badly designed complex multiplication instruction
    we cannot use, that's not present on 95% of devices. Because only
    compilers matter, right ?

    Future optimization options are very few, perhaps better register
    management to use more ld1/st1s.

    All timings below are in cycles :
    A53 :
    Length | C | New (lavu) | Old (lavc) | FFTW


    |-------------|-------------|-------------|-----
    4 | 842 | 420 | 1210 | 1460
    8 | 1538 | 1020 | 1850 | 2520
    16 | 3717 | 1900 | 3700 | 3990
    32 | 9156 | 4070 | 8289 | 8860
    64 | 21160 | 9931 | 18600 | 19625
    128 | 49180 | 23278 | 41922 | 41922
    256 | 112073 | 53876 | 93202 | 101092
    512 | 252864 | 122884 | 205897 | 207868
    1024 | 560512 | 278322 | 458071 | 453053
    2048 | 1295402 | 775835 | 1038205 | 1020265
    4096 | 3281263 | 2021221 | 2409718 | 2577554
    8192 | 8577845 | 4780526 | 5673041 | 6802722

    Apple M1
    New - Total for len 512 reps 2097152 = 1.459141 s
    Old - Total for len 512 reps 2097152 = 2.251344 s
    FFTW - Total for len 512 reps 2097152 = 1.868429 s

    New - Total for len 1024 reps 4194304 = 6.490080 s
    Old - Total for len 1024 reps 4194304 = 9.604949 s
    FFTW - Total for len 1024 reps 4194304 = 7.889281 s

    New - Total for len 16384 reps 262144 = 10.374001 s
    Old - Total for len 16384 reps 262144 = 15.266713 s
    FFTW - Total for len 16384 reps 262144 = 12.341745 s

    New - Total for len 65536 reps 8192 = 1.769812 s
    Old - Total for len 65536 reps 8192 = 4.209413 s
    FFTW - Total for len 65536 reps 8192 = 3.012365 s

    New - Total for len 131072 reps 4096 = 1.942836 s
    Old - Segfaults
    FFTW - Total for len 131072 reps 4096 = 3.713713 s

    Thanks to wbs for some simplifications, assembler fixes and a review
    and to jannau for giving it a look.

    • [DH] libavutil/aarch64/Makefile
    • [DH] libavutil/aarch64/tx_float_init.c
    • [DH] libavutil/aarch64/tx_float_neon.S
    • [DH] libavutil/tx.c
    • [DH] libavutil/tx_priv.h