From: Alexander GallDate: 20 februari 2006 11:08:00 GMT+01:00To: vlc@videolan.orgSubject: Possible endian bug in video_chrome/video_outputI have built the vlc svn snapshot 20060217 for Solaris 11 on SPARC.It mostly works but the video output (x11 and opengl) is broken. Withx11, the display is monochrome black/red and with opengl it looks likesome colors are missing or swapped. The visual I'm using is 24planes/32bpp, see attached output of xdpyinfo (screen [#0](https://code.videolan.org/videolan/vlc/-/issues/0)). Note thatthe "image byte order" is big endian (MSBFirst).I experimented a bit and found that the colours look ok with openglwhen I reverse the byte ordering of the 32 bit word in the macroCONVERT_Y_PIXEL in modules/video_chroma/i420_rgb.h (see attachedpatch). I have attached the output of vlc run with -vvv as well.I can't say whether this is a genuine bug or whether vlc just fails todetect the properties of my display correctly. The videou output andchroma code never seems to check the image byte order of the display(i.e. there's no reference to the symbols MSBFirst/LSBFirst), whichseems a bit surprising to me. In any case, I hope that my hack isenough to track down the source of the problem.BTW, the mpeg2dec utility that comes with the mpeg2dec librarydisplays video correctly with both x11 and opengl output using thelibmpeg2convert library. This library also has the advantage tosupport the SPARC VIS instruction set. Maybe it would make sense forvlc to use it as well.
name of display: :0.0version number: 11.0vendor string: Sun Microsystems, Inc.vendor release number: 6620maximum request size: 262140 bytesmotion buffer size: 256bitmap unit, bit order, padding: 32, MSBFirst, 32image byte order: MSBFirstnumber of supported pixmap formats: 4supported pixmap formats: depth 1, bits_per_pixel 1, scanline_pad 32 depth 8, bits_per_pixel 8, scanline_pad 32 depth 16, bits_per_pixel 16, scanline_pad 32 depth 24, bits_per_pixel 32, scanline_pad 32keycode range: minimum 8, maximum 254focus: window 0x1480009, revert to PointerRootnumber of extensions: 34 AccessX Adobe-DPS-Extension DAMAGE DOUBLE-BUFFER DPMS DPSExtension Extended-Visual-Information FBPM GLX LBX MIT-SCREEN-SAVER MIT-SHM MIT-SUNDRY-NONSTANDARD Multi-Buffering RECORD SECURITY SHAPE ST SUN_ALLPLANES SUN_DGA SUN_OVL SUN_SME SYNC SolarisIA TOG-CUP X-Resource XC-APPGROUP XC-MISC XEVIE XFIXES XIE XInputDeviceEvents XInputExtension XTESTdefault screen number: 0number of screens: 2screen [#0](https://code.videolan.org/videolan/vlc/-/issues/0): dimensions: 1280x1024 pixels (361x288 millimeters) resolution: 90x90 dots per inch depths (3): 1, 8, 24 root window id: 0x4a depth of root window: 24 planes number of colormaps: minimum 1, maximum 2 default colormap: 0x34 default number of colormap cells: 256 preallocated pixels: black 0, white 16777215 options: backing-store YES, save-unders YES largest cursor: 32x32 current input event mask: 0xfa2033 KeyPressMask KeyReleaseMask EnterWindowMask LeaveWindowMask ButtonMotionMask StructureNotifyMask SubstructureNotifyMask SubstructureRedirectMask FocusChangeMask PropertyChangeMask ColormapChangeMask number of visuals: 17 default visual id: 0x27 visual: visual id: 0x20 class: PseudoColor depth: 8 planes available colormap entries: 256 red, green, blue masks: 0x0, 0x0, 0x0 significant bits in color specification: 8 bits visual: visual id: 0x21 class: PseudoColor depth: 8 planes available colormap entries: 256 red, green, blue masks: 0x0, 0x0, 0x0 significant bits in color specification: 8 bits visual: visual id: 0x22 class: StaticColor depth: 8 planes available colormap entries: 256 red, green, blue masks: 0x7, 0x38, 0xc0 significant bits in color specification: 8 bits visual: visual id: 0x23 class: StaticGray depth: 8 planes available colormap entries: 256 red, green, blue masks: 0x0, 0x0, 0x0 significant bits in color specification: 8 bits visual: visual id: 0x24 class: GrayScale depth: 8 planes available colormap entries: 256 red, green, blue masks: 0x0, 0x0, 0x0 significant bits in color specification: 8 bits visual: visual id: 0x25 class: TrueColor depth: 8 planes available colormap entries: 8 per subfield red, green, blue masks: 0x7, 0x38, 0xc0 significant bits in color specification: 8 bits visual: visual id: 0x26 class: StaticGray depth: 8 planes available colormap entries: 256 red, green, blue masks: 0x0, 0x0, 0x0 significant bits in color specification: 8 bits visual: visual id: 0x2f class: PseudoColor depth: 8 planes available colormap entries: 255 red, green, blue masks: 0x0, 0x0, 0x0 significant bits in color specification: 8 bits visual: visual id: 0x30 class: PseudoColor depth: 8 planes available colormap entries: 255 red, green, blue masks: 0x0, 0x0, 0x0 significant bits in color specification: 8 bits visual: visual id: 0x27 class: TrueColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff, 0xff00, 0xff0000 significant bits in color specification: 8 bits visual: visual id: 0x28 class: TrueColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff, 0xff00, 0xff0000 significant bits in color specification: 8 bits visual: visual id: 0x29 class: DirectColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff, 0xff00, 0xff0000 significant bits in color specification: 8 bits visual: visual id: 0x2a class: DirectColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff, 0xff00, 0xff0000 significant bits in color specification: 8 bits visual: visual id: 0x2b class: TrueColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff, 0xff00, 0xff0000 significant bits in color specification: 8 bits visual: visual id: 0x2c class: TrueColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff, 0xff00, 0xff0000 significant bits in color specification: 8 bits visual: visual id: 0x2d class: TrueColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff, 0xff00, 0xff0000 significant bits in color specification: 8 bits visual: visual id: 0x2e class: TrueColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff, 0xff00, 0xff0000 significant bits in color specification: 8 bitsscreen [#1](https://code.videolan.org/videolan/vlc/-/issues/1): dimensions: 1280x1024 pixels (361x289 millimeters) resolution: 90x90 dots per inch depths (2): 1, 24 root window id: 0x4c depth of root window: 24 planes number of colormaps: minimum 1, maximum 1 default colormap: 0x35 default number of colormap cells: 256 preallocated pixels: black 0, white 16777215 options: backing-store YES, save-unders YES largest cursor: 64x64 current input event mask: 0xfa2033 KeyPressMask KeyReleaseMask EnterWindowMask LeaveWindowMask ButtonMotionMask StructureNotifyMask SubstructureNotifyMask SubstructureRedirectMask FocusChangeMask PropertyChangeMask ColormapChangeMask number of visuals: 1 default visual id: 0x36 visual: visual id: 0x36 class: TrueColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff0000, 0xff00, 0xff significant bits in color specification: 8 bits
VLC media player 0.8.5-svn Janus[00000001] main vlc debug: opening config file /home/gall/.vlc/vlcrc[00000001] main vlc debug: checking builtin modules[00000001] main vlc debug: checking plugin modules[00000001] main vlc debug: loading plugins cache file /home/gall/.vlc/cache/plugins-0404be.dat[00000001] main vlc debug: recursively browsing `modules'[00000001] main vlc debug: recursively browsing `/usr/local/lib/vlc'[00000001] main vlc debug: recursively browsing `plugins'[00000001] main vlc debug: module bank initialized, found 196 modules[00000001] main vlc debug: opening config file /home/gall/.vlc/vlcrc[00000001] main vlc debug: CPU has capabilities FPU [00000001] main vlc debug: looking for memcpy module: 1 candidate[00000001] main vlc debug: using memcpy module "memcpy"[00000254] main playlist debug: waiting for thread completion[00000254] main playlist debug: thread 2 (playlist) created at priority 0 (src/playlist/playlist.c:184)[00000255] main private debug: waiting for thread completion[00000255] main private debug: thread 3 (preparser) created at priority 0 (src/playlist/playlist.c:210)[00000256] main interface debug: looking for interface module: 1 candidate[00000256] main interface debug: using interface module "hotkeys"[00000256] main interface debug: thread 4 (interface) created at priority 0 (src/interface/interface.c:229)[00000258] main interface debug: looking for interface module: 5 candidates[00000258] main interface debug: using interface module "screensaver"[00000258] main interface debug: thread 5 (interface) created at priority 0 (src/interface/interface.c:229)[00000260] main interface debug: looking for interface module: 4 candidates[00000260] main interface debug: using interface module "wxwidgets"[00000260] main interface debug: thread 6 (manager) created at priority 0 (src/interface/interface.c:214)[00000260] wxwidgets interface debug: Using last windows config '(-1,0,0,1280,1024)(6,0,0,-1,150)'[00000260] wxwidgets interface debug: id=6 p=(0,0) s=(-1,150)[00000260] wxwidgets interface debug: last windows config is invalid (ignored)[00000254] main playlist debug: adding playlist item `dvdsimple:///vol/dev/aliases/cdrom0' ( dvdsimple:///vol/dev/aliases/cdrom0 )[00000254] main playlist debug: creating statistics handler[00000254] main playlist debug: creating new input thread[00000264] main input debug: waiting for thread completion[00000264] main input debug: `dvdsimple:///vol/dev/aliases/cdrom0' gives access `dvdsimple' demux `' path `/vol/dev/aliases/cdrom0'[00000264] main input debug: creating demux: access='dvdsimple' demux='' path='/vol/dev/aliases/cdrom0'[00000265] main demuxer debug: looking for access_demux module: 1 candidate[00000264] main input debug: thread 7 (input) created at priority 0 (src/input/input.c:260)[00000265] dvdread demuxer debug: VMG opened[00000265] dvdread demuxer debug: number of titles: 4[00000265] dvdread demuxer debug: title 0 has 23 chapters[00000265] dvdread demuxer debug: title 1 has 23 chapters[00000265] dvdread demuxer debug: title 2 has 2 chapters[00000265] dvdread demuxer debug: title 3 has 2 chapters[00000265] dvdread demuxer debug: open VTS 4, for title 1[00000265] dvdread demuxer debug: title 1 vts_title 1 pgc 1 pgn 1 start 0 end 1863688 blocks: 1863689[00000264] main input debug: selecting program id=0[00000265] dvdread demuxer debug: audio position 0[00000265] dvdread demuxer debug: spu 1 0x80000200[00000265] dvdread demuxer debug: spu 2 0x80010300[00000265] main demuxer debug: using access_demux module "dvdread"[00000267] main decoder debug: looking for decoder module: 23 candidates[00000267] main decoder debug: using decoder module "libmpeg2"[00000267] main decoder debug: thread 8 (decoder) created at priority 0 (src/input/decoder.c:159)[00000272] main decoder debug: looking for decoder module: 23 candidates[00000272] main decoder debug: using decoder module "a52"[00000272] main decoder debug: thread 9 (decoder) created at priority 0 (src/input/decoder.c:159)[00000264] main input debug: `dvdsimple:///vol/dev/aliases/cdrom0' successfully opened[00000267] libmpeg2 decoder debug: 720x480 (display 720,480), aspect 768000, sar 32:27, 29.971 fps[00000267] main decoder debug: no usable vout present, spawning one[00000275] main video output debug: window size: 853x480[00000275] main video output debug: looking for video output module: 5 candidates[00000276] main private debug: Registering subpicture channel, ID: 2[00000276] main private debug: Registering subpicture channel, ID: 3[00000276] main private debug: Registering subpicture channel, ID: 4[00000276] main private debug: Registering subpicture channel, ID: 5[00000275] opengl video output debug: Texture size: 1024x512[00000278] main private debug: looking for opengl provider module: 1 candidate[00000278] glx private debug: Using GLX 1.3 API[00000278] main private debug: window size: 853x480[00000278] main private error: option glx-shm does not exist[00000278] glx private debug: Window manager supports NetWM[00000272] a52 decoder: A/52 channels:6 samplerate:48000 bitrate:384000[00000272] main decoder debug: no aout present, spawning one[00000280] main audio output debug: looking for audio output module: 2 candidates[00000280] main audio output debug: using audio output module "aout_sdl"[00000280] main audio output debug: output 's16b' 48000 Hz Stereo frame=1 samples/4 bytes[00000280] main audio output debug: mixer 'fl32' 48000 Hz Stereo frame=1 samples/8 bytes[00000280] main audio output debug: filter(s) 'fl32'->'s16b' 48000 Hz->48000 Hz Stereo->Stereo[00000282] main private debug: looking for audio filter module: 23 candidates[00000282] main private debug: using audio filter module "float32tos16"[00000280] main audio output debug: found a filter for the whole conversion[00000280] main audio output debug: looking for audio mixer module: 3 candidates[00000280] main audio output debug: using audio mixer module "float32_mixer"[00000280] main audio output debug: input 'a52 ' 48000 Hz 3F2R/LFE frame=1536 samples/1536 bytes[00000280] main audio output debug: filter(s) 'a52 '->'fl32' 48000 Hz->48000 Hz 3F2R/LFE->Stereo[00000300] main private debug: looking for audio filter module: 23 candidatesNo accelerated IMDCT transform found[00000300] main private debug: using audio filter module "a52tofloat32"[00000280] main audio output debug: found a filter for the whole conversion[00000280] main audio output debug: filter(s) 'fl32'->'fl32' 52800 Hz->48000 Hz Stereo->Stereo[00000301] main private debug: looking for audio filter module: 23 candidates[00000301] main private debug: using audio filter module "bandlimited_resampler"[00000280] main audio output debug: found a filter for the whole conversion[00000278] glx private debug: Window manager supports _NET_WM_STATE_FULLSCREEN[00000278] glx private debug: Window manager supports _NET_WM_STATE_ABOVE[00000278] glx private debug: Window manager supports _NET_WM_STATE_BELOW[00000278] main private debug: using opengl provider module "glx"[00000275] main video output debug: using video output module "opengl"[00000275] main video output debug: waiting for thread completion[00000275] main video output debug: got 1 direct buffer(s)[00000275] main video output debug: picture in 720x480 (0,0,720x480), chroma I420, ar 16:9, sar 32:27[00000275] main video output debug: picture user 720x480 (0,0,720x480), chroma I420, ar 16:9, sar 32:27[00000275] main video output debug: picture out 720x480 (0,0,720x480), chroma RV32, ar 16:9, sar 32:27[00000275] main video output debug: looking for chroma module: 5 candidates[00000275] main video output debug: using chroma module "i420_rgb"[00000275] main video output debug: indirect render, mapping render pictures 0-7 to system pictures 1-8[00000275] main video output debug: thread 11 (video output) created at priority 0 (src/video_output/video_output.c:421)[00000303] main private warning: dts != current_pts (617028)[00000303] main private warning: backward_pts != current_pts (-33366)[00000275] main video output warning: late picture skipped (310287)[00000275] main video output warning: late picture skipped (72724)[00000275] main video output warning: late picture skipped (23098)[00000275] main video output warning: late picture skipped (-10165)[00000275] main video output warning: late picture skipped (-60126)[00000264] main input debug: control type=0[00000264] main input debug: control: stopping input[00000264] main input debug: closing input[00000267] main decoder debug: removing module "libmpeg2"[00000267] main decoder debug: thread 8 joined (src/input/decoder.c:191)[00000267] main decoder debug: killing decoder fourcc `mpgv', 118 PES in FIFO[00000272] main decoder debug: removing module "a52"[00000272] main decoder debug: thread 9 joined (src/input/decoder.c:191)[00000272] main decoder debug: killing decoder fourcc `a52 ', 0 PES in FIFO[00000300] main private debug: removing module "a52tofloat32"[00000301] main private debug: removing module "bandlimited_resampler"[00000280] main audio output debug: removing module "aout_sdl"[00000282] main private debug: removing module "float32tos16"[00000280] main audio output debug: removing module "float32_mixer"[00000264] main input debug: Program doesn't contain anymore ES[00000265] main demuxer debug: removing module "dvdread"[00000264] main input debug: thread 7 joined (src/input/input.c:402)[00000254] main playlist debug: garbage collector destroying 1 vout[00000275] main video output debug: removing module "i420_rgb"[00000278] main private debug: removing module "glx"[00000275] main video output debug: removing module "opengl"[00000275] main video output debug: thread 11 joined (src/video_output/video_output.c:461)(:25683): Gtk-CRITICAL **: file gtkwidget.c: line 5916: assertion `GTK_IS_WIDGET (widget)' failed(:25683): GLib-GObject-CRITICAL **: file gobject.c: line 1222: assertion `G_IS_OBJECT (object)' failed[00000001] main vlc debug: removing all interfaces[00000260] main interface debug: thread 6 joined (src/interface/interface.c:256)[00000260] main interface debug: removing module "wxwidgets"[00000258] main interface debug: thread 5 joined (src/interface/interface.c:256)[00000258] main interface debug: removing module "screensaver"[00000256] main interface debug: thread 4 joined (src/interface/interface.c:256)[00000256] main interface debug: removing module "hotkeys"[00000001] main vlc debug: removing playlist handler[00000255] main private debug: thread 3 joined (src/playlist/playlist.c:247)[00000254] main playlist debug: thread 2 joined (src/playlist/playlist.c:248)[00000254] main playlist: stopping playback[00000254] main playlist debug: deleting playlist item `dvdsimple:///vol/dev/aliases/cdrom0'[00000001] main vlc debug: removing all video outputs[00000001] main vlc debug: removing all audio outputs[00000001] main vlc debug: TIMER Playlist walk : Total 0.010 ms / 1 intvls (Avg 0.010 ms)[00000001] main vlc debug: removing module "memcpy"[00000001] main vlc debug: opening config file /home/gall/.vlc/vlcrc[00000001] main vlc debug: saving plugins cache file /home/gall/.vlc/cache/plugins-0404be.dat
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
I have i_rmask: 0x000000ffi_rrshift: 0i_lrshift: 0i_gmask: 0x0000ff00i_rrshift: 0i_lrshift: 8i_bmask: 0x00ff0000i_rrshift: 0i_lrshift: 16The mask values are wrong. They should bei_rmask: 0xff000000i_gmask: 0x00ff0000i_bmask: 0x0000ff00I'm not sure where exactly these are set for opengl. If it's inmodules/video_output/opengl.c, then the problem is obvious, becausethe values are just set statically, instead of read from thecapabilities of the output device.Now, when I set the proper mask values by hand, the output is stillnot ok. This is because src/video_output/video_output.c:MaskToShift()produces the wrong result for a mask of 0xff000000. The line i_high = i_mask + i_low; /* higher bit of the mask */results in an overflow and the value of rshift becomes 31369 (itshould be 0).When I fix this as well, the output is finally correct.BTW, MaskToShift seems to expect that the mask can be smaller than 8bits, in which case the lower order bits of a color value arediscarded by RGB2PIXEL. I'm wondering whether this makes sense and ifit actually occurs in practice.Finally, the same problem needs to be fixed for the xvideo and glxoutput modules as well.