Bonjour,

J’utilise MainConcept pour décoder un fichier vidéo, et SDL_Overlay pour l’afficher.

Mon problème est que l'image affichée n'est pas du tout cohérente (dominance de vert, comme une image cryptée Canal+).
Il semblerait que je ne traite pas convenablement les 3 canaux YUV, à moins que mon paramétrage de mpeg / SQL n'est pas convenable...

Je travaille sous Qt 4.5.0, Mandriva.

Merci par avance pour votre aide

Frédéric;

Voici les morceaux de codes:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 
// **************** décodage *********************** //
 // Creation de la structure mpegInInfo
m_pMpegInInfo = mpegInNew(NULL,NULL);
….
m_pMpegInInfo->outputTypes = VIDEO_RGB | AUDIO_PCM;
m_pMpegInInfo->fourCC      = FOURCC_YV12; 
m_pMpegInInfo->use_external_frame_buffer = 1 ;
 
….
m_FrameInfo.four_cc = FOURCC_YV12;
 
m_FrameInfo.stride[0]= largeurFrame;
m_FrameInfo.stride[2]= largeurFrame /4;
m_FrameInfo.stride[1]= largeurFrame /4;
 
….
// buffer de réception
unsigned char * bufferRx = new unsigned char[largeurFrame*hauteurFrame] * 1.5;
 
….
m_FrameInfo.plane[0] = bufferRx;
m_FrameInfo.plane[2] = bufferRx  + (largeurFrame *hauteurFrame);
m_FrameInfo.plane[1] = bufferRx  + (largeurFrame *hauteurFrame) + ( (largeurFrame *hauteurFrame) / 4 );
 
// réception
mpegInSeekFrame(m_pMpegInInfo,p_iFramePos)
....
 
// **************** Affichage *********************** //
 
static SDL_Surface *screen;
static SDL_Overlay *bmp;
 
.....
// initialisation SDL
SDL_Init(SDL_INIT_VIDEO)..
 
screen = SDL_SetVideoMode(zoneDest.width(), zoneDest.height(), 12, SDL_HWSURFACE);
bmp = SDL_CreateYUVOverlay(zoneDest.width(), zoneDest.height(), SDL_YV12_OVERLAY, screen);
 
// Lock
SDL_LockYUVOverlay(bmp);
 
SDL_Rect blitrect = {zoneDes.x(),zoneDes.y(),zoneDes.width(),zoneDes.height()};
 
bmp->pitches[0] = largeurFrame;
bmp->pitches[2] = largeurFrame/4;
bmp->pitches[1] = largeurFrame/4;
 
bmp->pixels[0] = bufferRx ;
bmp->pixels[2] = bufferRx + largeurFrame  * hauteurFrame;
bmp->pixels[1] = bufferRx + largeurFrame  * hauteurFrame + (largeurFrame * hauteurFrame/4);
 
// unlock
SDL_UnlockYUVOverlay(bmp);
 
// afichage
SDL_DisplayYUVOverlay(bmp, &blitrect);