Re: [vdr] OSD and subtitles trouble
On Sat, Nov 09, 2013 at 01:57:37AM +0200, Marko Mäkelä wrote: (1) The bottom 1% lines of the OSD are not being cleared when the OSD extends that low. (I can choose up to 99% height and 0% vertical offset.) This looks like a bug in DirectFB or the way how softdevice is using it. There is a comment related to Matrox in video-dfb.c, AFAIU related to the video layer, not the OSD layer. I did a short test recording of a 4:3 program. Depending on the softdevice crop mode, the garbage area at the bottom shrinks (from about 3 lines to 1 or even 0). (2) Changes in DVB subtitles will flash the OSD layer (make it empty for a very short time) if an OSD is active. I suppose that DVB subtitles should not be displayed at all when OSD layer is active. This is a bug in SoftOsd.c or in video-dfb.c. The OpenOSD call in the cSoftOsd constructor was clearing the OSD layer on the physical screen, even when !cOsd::Active(). To fix this, I made cDFBVideoOut::OpenOSD() a no-op, or renamed it to cDFBVideoOut::ClearOSD(), which is where this clearing should have been done. I also moved some of the initialization to cSoftOsd::Action(), which seems to be a more appropriate place. cSoftOsd derives from both cOsd and cThread, to do the intensive work in a background thread. Now I have some trouble with VDR crashing every now and then when I press Recordings or Menu. I fixed most Valgrind warnings in Softdevice, so that it is silent when I press buttons to hide or show the OSD. There are some warnings left in cRect::Intersects() or similar, seemingly not related to softdevice code. I will investigate further. Also, on VDR 2.0.4 startup, cRecordings::ScanVideoDir() is calling cRecording::cRecording(), which according to Valgrind is reading past some strdup() buffer. I do have libc6-dbg installed, so I hope it is not a false alarm. I only had 2 short test recordings in my video directory, so this should be easy to debug, once I rebuild vdr in debug mode. I only had debug symbols for softdevice in my session, and I did not yet try vgdb-server, which is better for multi-threaded programs. Best regards, Marko ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] OSD and subtitles trouble
On Sun, Nov 10, 2013 at 09:34:12PM +0200, Marko Mäkelä wrote: > On Sun, Nov 10, 2013 at 04:44:44PM +0200, Sami Ketola wrote: > >This is not entirely true. All broadcasters in Finland are using DVB > >subtitles except "Nelonen Media" on all their channels and MTV Media on > >"Sub" channel. Yes even MTV3 seems to be DVB subtitled now. > > I must admit that I do not watch TV that much, except now when debugging > softdevice. :) I was not aware of these very welcome news. > > However, I am still seeing "burned" subtitles on the commercial DVB-T > channels, for example in the currently active MTV3 program > "Selviytyjät". > Programs spoken in finnish, MTV3 has an option for DVB subtitles in finnish. ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] OSD and subtitles trouble
On Sun, Nov 10, 2013 at 04:44:44PM +0200, Sami Ketola wrote: This is not entirely true. All broadcasters in Finland are using DVB subtitles except "Nelonen Media" on all their channels and MTV Media on "Sub" channel. Yes even MTV3 seems to be DVB subtitled now. I must admit that I do not watch TV that much, except now when debugging softdevice. :) I was not aware of these very welcome news. However, I am still seeing "burned" subtitles on the commercial DVB-T channels, for example in the currently active MTV3 program "Selviytyjät". Marko ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] OSD and subtitles trouble
On Sat, 9 Nov 2013 13:59:51 +0200 Marko Mäkelä wrote: > Were you able to test the other problem (the OSD menu becomes fully > transparent and then normal again when subtitles would want to update > the OSD)? I can provide a short recording if needed. I guess that these > bitmap-based subtitles are not too widespread functionality. Even here > in Finland, only the state-owned YLE is using them; the commercial > broadcasters are burning the subtitles into the video layer. This is not entirely true. All broadcasters in Finland are using DVB subtitles except "Nelonen Media" on all their channels and MTV Media on "Sub" channel. Yes even MTV3 seems to be DVB subtitled now. Sami -- Sami Ketola ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] OSD and subtitles trouble
Hi Klaus, I have no such problem here. If I open the menu of the channel/progress display while subtitles are active, no subtitles are displayed while the menu is open and they continue to be displayed once the menu has been closed again. OK. The only difference that I am seeing (after disabling the dirty_lines[] optimization) that the OSD menu will disappear for less than half a second when the subtitles would want to do something. The menu would reappear again, and no subtitles are displayed until I close the OSD menu. As soon as I close the OSD menu, the subtitles (if any are active at that time) would be displayed immediately. "burning the subtitles into the video layer" is probably the worst idea ever. I fully agree. I guess that the commercial broadcasters try to avoid "leaking" too much metadata. Or they are just lazy, such as never showing the episode number of name of a series in the EPG data. If they sent proper subtitles and VPS signals and what not, then commercial breaks could be detected easier, without having to decompress and interpret the video stream. (Well, I guess there are VDR plugins for this; another reason to use VDR instead of some proprietary product.) Also the state-owned broadcaster YLE is bending the rules a little. There usually is a "Dutch" language audio track that contains the original audio mixed with a speech synthesizer that is reading the Finnish subtitles. More recently, they have started to introduce "Dutch" language subtitles that actually are Finnish transcript of the Finnish audio track for the hearing impaired. In any case, this is good service: The same video broadcast can serve all audiences. For example, a program that has original audio in N languages can be sent with N+M audio tracks and N+M sets of subtitles. In the times of the analog TV, the program could be sent in 2 channels, once in Swedish and once in Finnish, and that is it. When the whole OSD is closed, ther is nothing that gets displayed. OK, I think I will have to check what is happening around cOsd::~cOsd(). It could be that Softdevice is simply clearing the OSD layer at wrong points of the object lifecycle, in a way that happens to work for everything else than subtitles. Best regards, Marko ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] OSD and subtitles trouble
On 09.11.2013 12:59, Marko Mäkelä wrote: On Sat, Nov 09, 2013 at 11:36:55AM +0100, Klaus Schmidinger wrote: I just tried this on my VDR with a TT S2-6400 and there was no such problem. I assume that this is related to the softdevice OSD implementation and not the core VDR. Thank you for testing, Klaus! Were you able to test the other problem (the OSD menu becomes fully transparent and then normal again when subtitles would want to update the OSD)? I have no such problem here. If I open the menu of the channel/progress display while subtitles are active, no subtitles are displayed while the menu is open and they continue to be displayed once the menu has been closed again. I can provide a short recording if needed. I guess that these bitmap-based subtitles are not too widespread functionality. Even here in Finland, only the state-owned YLE is using them; the commercial broadcasters are burning the subtitles into the video layer. "burning the subtitles into the video layer" is probably the worst idea ever. This totally deprives the viewer of the possibility to choose between different language subtitles or turn them off altogether. Almost all of the test samples I have here use proper DVB subtitle bitmaps. In any case, these are very minor problems now; I have an acceptable workaround for both. I just thought that I would go the last mile and polish a bit more, to prepare for a proper release of softdevice. While I now understand the VDR and softdevice OSD implementation a little better, I still do not fully understand it. Currently, it is a bit of a mystery for me what happens when the OSD is closed and the screen is cleared. In osd.c I understood that there could be a transparent "background pixmap" whose relevant part would be invalidated when upper-layer pixmaps or bitmaps get removed. But, will this also happen when the whole OSD is closed, or only for closing individual "windows"? When the whole OSD is closed, ther is nothing that gets displayed. Based on the SoftOsd.c debug output and some gdb sessions, it seems to me that the cSoftOsd object gets created and destroyed repeatedly, maybe every time something is displayed and then hidden again. Is this the correct object life cycle? Yes. Is there some wiki page or other documentation than the source code? Not to my knowledge. Klaus ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] OSD and subtitles trouble
On Sat, Nov 09, 2013 at 11:36:55AM +0100, Klaus Schmidinger wrote: I just tried this on my VDR with a TT S2-6400 and there was no such problem. I assume that this is related to the softdevice OSD implementation and not the core VDR. Thank you for testing, Klaus! Were you able to test the other problem (the OSD menu becomes fully transparent and then normal again when subtitles would want to update the OSD)? I can provide a short recording if needed. I guess that these bitmap-based subtitles are not too widespread functionality. Even here in Finland, only the state-owned YLE is using them; the commercial broadcasters are burning the subtitles into the video layer. In any case, these are very minor problems now; I have an acceptable workaround for both. I just thought that I would go the last mile and polish a bit more, to prepare for a proper release of softdevice. While I now understand the VDR and softdevice OSD implementation a little better, I still do not fully understand it. Currently, it is a bit of a mystery for me what happens when the OSD is closed and the screen is cleared. In osd.c I understood that there could be a transparent "background pixmap" whose relevant part would be invalidated when upper-layer pixmaps or bitmaps get removed. But, will this also happen when the whole OSD is closed, or only for closing individual "windows"? Based on the SoftOsd.c debug output and some gdb sessions, it seems to me that the cSoftOsd object gets created and destroyed repeatedly, maybe every time something is displayed and then hidden again. Is this the correct object life cycle? Is there some wiki page or other documentation than the source code? Best regards and thank you for the great work, Marko ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] OSD and subtitles trouble
On 09.11.2013 00:57, Marko Mäkelä wrote: ... If I set the OSD size to 100% height, then VDR will never clear the very bottom lines at the screen. If I set it to 99% height, everything will be erased properly when I leave the main menu, or the program info at the bottom of the screen is cleared. If I set it to 99% height and 1% vertical offset, the garbage will appear again. My current understanding is that it is VDR 2.0.4 that fails to post a proper draw request to clear the bottom of the screen. I just tried this on my VDR with a TT S2-6400 and there was no such problem. I assume that this is related to the softdevice OSD implementation and not the core VDR. Klaus ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
[vdr] OSD and subtitles trouble
I did some more hacking and got softdevice to a useable state on VDR 2.0.4. My patch against softdevice cvs is attached. The TL;DR version is that I suspect 2 bugs in VDR 2.0.4: (1) The bottom 1% lines of the OSD are not being cleared when the OSD extends that low. (I can choose up to 99% height and 0% vertical offset.) (2) Changes in DVB subtitles will flash the OSD layer (make it empty for a very short time) if an OSD is active. I suppose that DVB subtitles should not be displayed at all when OSD layer is active. On Mon, Nov 04, 2013 at 10:30:14PM +1000, Torgeir Veimo wrote: Softdevice had transparency 'dithering' for when there's only 1-bit transparency, did you look at that option? I am a bit unsure if it really is using 1-bit transparency. The background inside the LCARS main menu is darker (but still translucent) than the area outside the menu borders. Everything else in the OSD layer is opaque. With "perf top" I noticed that Softdevice was spending a lot of time, scaling the OSD layer down from 1920×1080 to 720×576 that is my video output resolution. So, I hardcoded the OSD size back to 720×576. OSD updates became snappy (fewer pixels to copy to the cSoftOsd::OSD_Bitmap[], and from there it would be a straight memcpy to the video memory). The following problem was unaffected by this fix. If I set the OSD size to 100% height, then VDR will never clear the very bottom lines at the screen. If I set it to 99% height, everything will be erased properly when I leave the main menu, or the program info at the bottom of the screen is cleared. If I set it to 99% height and 1% vertical offset, the garbage will appear again. My current understanding is that it is VDR 2.0.4 that fails to post a proper draw request to clear the bottom of the screen. The next problem was related to my patch. It turned out that cSoftOsd::Flush() has to check cOsd::IsTrueColor() and render pixmaps or bitmaps accordingly. This would also explain why I previously never saw any output from the Classic VDR OSD (it is the only non-TrueColor built-in theme). The garbage-at-bottom problem also affects DVB subtitles. If I move the "Setup.DVB$Subtitle offset" too low, the pixels from the last 4 or so of the 576 lines will never be cleared (only drawn when there is some "y" or "p" or "q" character that extends to to the "garbage area"). A small (old) problem with the Softdevice OSD/subtitles remains. When the OSD is active while the current stream is showing DVB subtitles, the OSD layer will be cleared, but no subtitles will be displayed. Eventually, parts of the OSD will be repainted. It turns out that this problem was emphasized by the cSoftOsd::dirty_lines[] array. If I commit out the dirty_lines[] checks, the OSD will be properly repainted, but the entire OSD layer will be cleared for a few frames whenever the subtitles are about to display. (No subtitles will be actually displayed, because the OSD layer is active.) How to avoid this short OSD flash? I tried commenting out all cSoftOsd::Clear() calls, but that did not help (other than leaving DVB subtitles garbage on the screen when the OSD layer was not active). Note: I understand that the non-truecolor DVB subtitles are not being alpha-blended to the truecolor OSD layer. It is OK for me not to see subtitles when the OSD is active. But it is not OK that the active OSD layer gets cleared whenever subtitles are attempting to display or clear themselves. Best regards, Marko Index: Makefile === RCS file: /cvsroot/softdevice/softdevice/Makefile,v retrieving revision 1.42 diff -p -u -r1.42 Makefile --- Makefile 14 Apr 2008 02:52:10 - 1.42 +++ Makefile 8 Nov 2013 23:45:33 - @@ -124,7 +124,7 @@ FFMPEGLIBS = -lavcodec -lavformat -lz DEFINES += -DUSE_MMX # uncomment this line if you do not have MMX2 -DEFINES += -DUSE_MMX2 +#DEFINES += -DUSE_MMX2 ### Allow user defined options to overwrite defaults: Index: SoftOsd.c === RCS file: /cvsroot/softdevice/softdevice/SoftOsd.c,v retrieving revision 1.37 diff -p -u -r1.37 SoftOsd.c --- SoftOsd.c 17 Apr 2011 16:06:31 - 1.37 +++ SoftOsd.c 8 Nov 2013 23:45:34 - @@ -25,7 +25,6 @@ //#define SCALEDEBV(out...) printf(out) //#define SCALEDEBH(out...) printf(out) - #ifndef OSDDEB #define OSDDEB(out...) #endif @@ -55,16 +54,17 @@ #define COLOR_64BIT(x) ( ((x)<<32) | (x) ) #define ALPHA_VALUE(x) ( (x) << 24 ) -// the same constants for MMX mode +//#undef USE_MMX +//#undef USE_MMX2 + +#ifdef USE_MMX2 static uint64_t transparent_thr= COLOR_64BIT(ALPHA_VALUE(TRANSPARENT_THRESHOLD>>1)); static uint64_t opacity_thr= COLOR_64BIT(ALPHA_VALUE(OPACITY_THRESHOLD>>1)); static uint64_t pseudo_transparent = COLOR_64BIT(COLOR_KEY); +#endif // USE_MMX2 int cSoftOsd::colorkey; -//#undef USE_MMX -//#undef USE_MMX2 - #undef SPLAT_U1