[fixed] bpgdec.exe console flicker

Reported bugs that have been closed and/or resolved

Moderators: XnTriq, helmut, xnview, Dreamer

Marsu42
Posts: 96
Joined: Tue Sep 30, 2014 6:55 am

[fixed] bpgdec.exe console flicker

Post by Marsu42 »

I know this is looking a gift horse in the mouth, and it's great to see bpg support in xnview (Thanks!!!) ...

... but: On opening each .bpg file that isn't in xnview's cache, there's a quick console flicker of the bpgdec.exe program, i.e. the window pops up in front of xnview and then closes quickly. Isn't there a way to run bpgdec.exe in a hidden console or at least minimized - win seems to have the api for that as at least cmd.exe's "start" command features the /inv switch?
Last edited by Marsu42 on Mon Oct 10, 2016 12:02 pm, edited 1 time in total.
User avatar
xnview
Author of XnView
Posts: 43444
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: 0.83 (Win64): bpgdec.exe console flicker

Post by xnview »

See Issue 984 for details.
Pierre.
Marsu42
Posts: 96
Joined: Tue Sep 30, 2014 6:55 am

Re: 0.83 (Win64): bpgdec.exe console flicker

Post by Marsu42 »

xnview wrote:See Issue 984 for details.
Thanks, I'm keen to use 0.84 then.

Btw IrfanView has a bpg test version with bpg read support, too - but not using the bpgenc.exe cli decoder, but build right into the app.
heimaki
Posts: 43
Joined: Thu Dec 27, 2012 8:04 pm

Re: [fixed] bpgdec.exe console flicker

Post by heimaki »

just in case.

there's a BPG plugin that can even write such files in xnview.

https://github.com/leavinel/BPG-Plugins

works only in x86 versions though.
Marsu42
Posts: 96
Joined: Tue Sep 30, 2014 6:55 am

Re: [fixed] bpgdec.exe console flicker

Post by Marsu42 »

heimaki wrote:there's a BPG plugin that can even write such files in xnview.
Yeah, well, I didn't mention this on purpose ...

* it hangs my x86 XnView Classic or MP on "Saving picture...", but maybe that's just me (again :-))
* zero config options, not even for the compression rate don't make this that attractive :-o

Concerning patents, I'd say a hevc encoder inside XnView is probab more hassle than it's worth. Fast bpg reading would be enough as far as I'm concerned - I dunno how the external bpgdec.exe approach compares to a dll.
heimaki
Posts: 43
Joined: Thu Dec 27, 2012 8:04 pm

Re: [fixed] bpgdec.exe console flicker

Post by heimaki »

Marsu42 wrote:
* it hangs my x86 XnView Classic or MP on "Saving picture...", but maybe that's just me (again :-))
* zero config options, not even for the compression rate don't make this that attractive :-o
you need to have proper Xbpg.ini in the plugins dir....
settings in Xbpg.ini

-q (0~51) set quantizer parameter (smaller gives better quality, default=20)
-f (420|422|444) set the preferred chroma format (default=422)
-b (8|10) set the bit depth (default=8)
-loseless enable lossless mode
-e (jctvc|x265) select the HEVC encoder (default=jctvc)
-m (1~9) select the compression level (1=fast, 9=slow, default=8)

i have only this in there (not sure if those settings really make sense though :?):
24:-q 25 -e x265
8:-q 35 -e jctvc
and it works fine, also in xnview mp x86
Marsu42
Posts: 96
Joined: Tue Sep 30, 2014 6:55 am

Re: [fixed] bpgdec.exe console flicker

Post by Marsu42 »

heimaki wrote:you need to have proper Xbpg.ini in the plugins dir....
Thanks ... I didn't now clairvoyance is required to figure out there's an ini involved :-o
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: [fixed] bpgdec.exe console flicker

Post by XnTriq »

omniplex ([url=http://newsgroup.xnview.com/viewtopic.php?p=129656#p129656]SVG support via rsvg-convert.exe[/url]) wrote:About the stupid byte wanting to be fixed to get rid of the console window open/close: Some obscure tool known as editbin.exe can do this, and after about an hour with even more obscure downloads I managed to locate it in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin. Where it still failed, because it's just a wrapper for some link.exe, but not the Open Watcom idea of link.exe :idea: After running vcvars32 in the VC/bin folder editbin.exe in the same folder was finally ready for action:

Code: Select all

editbin /SUBSYSTEM:Windows "c:\Program Files (x86)\XnView\PlugIns\bpgdec.exe"
A comparison with the original 0.9.6 bpgdec.exe reported two modified bytes: At offset D8 old B4 new B3, at offset DC old 03 new 02. At least the latter matches what stackoverflow predicted. Test with XnView 2.35: WFM. :D
Marsu42
Posts: 96
Joined: Tue Sep 30, 2014 6:55 am

Re: [fixed] bpgdec.exe console flicker

Post by Marsu42 »

XnTriq wrote:A comparison with the original 0.9.6 bpgdec.exe reported two modified bytes
Right, it's nice you like to dabble with multiple tools, but let me just calculate the ratio of the size of the Visual Studio download vs. the two modified bytes in the target exe :-p ... I'd rather use the next post, download pebuild.exe and just change "Subsystem" in bpgdec.exe from 3 to 2 - this fixes the console flicker, too.

http://cnewsgroup.xnview.com/viewtopic. ... 56#p129683
captaincavern wrote:Sorry, I should have mentioned there is an easy to use GUI tool to change the subsystem flag in executable headers. That's NW PE Builder: http://www.woodmann.com/collaborative/t ... PE_Builder. The subsystem value needs to be changed from 3 to 2.
But thanks for digging this out, I guess it's the same solution that will be featured in the upcoming 0.84 release. Now opening a bpg file is just horribly slow, but usable for slideshows if not for fast image browsing.
heimaki
Posts: 43
Joined: Thu Dec 27, 2012 8:04 pm

Re: [fixed] bpgdec.exe console flicker

Post by heimaki »

a hex editor or a PE editor can easily change the subsystem.

in this case, just change in bpgdec.exe, beginning @ $000D8

7C 70 02 03

to

7C 70 02 02

i used that many times, for programs that call unzip.exe and others.

btw, there are newer versions available.

http://bellard.org/bpg/
Marsu42
Posts: 96
Joined: Tue Sep 30, 2014 6:55 am

Re: [fixed] bpgdec.exe console flicker

Post by Marsu42 »

heimaki wrote:btw, there are newer versions available. http://bellard.org/bpg/
Decoding didn't change in the last releases (according to the changelog), only metadata handling which is semi-broken anyway.

For an update: the binaries from the author are mingw64-based - it would be nice to have the much smaller native win32 compiles like the one bundled with xnview, but /me only has cygwin installed. Pity bpg feels abandoned as the author is (now) working for Google, the fierce mpeg-la competitor. Imho it's unlikely that they want their personel promoting on a h265 wrapper if they want to push their own vp10 and webp formats. With the latest source code, even the jctvc wrapper is broken and only x265 compiles.
heimaki
Posts: 43
Joined: Thu Dec 27, 2012 8:04 pm

Re: [fixed] bpgdec.exe console flicker

Post by heimaki »

i'm not gonna bother with encoding (too many dependencies), but here's a x64 bit version of bpgdec.exe 0.9.7 with subsystem changed.

64bit version might decode slightly faster, i haven't tested it...

i doubt some format will take jpg's place the next years. they have only better quality by a very small margin, but are all a lot slower.
Last edited by heimaki on Tue Oct 11, 2016 9:41 pm, edited 1 time in total.
Marsu42
Posts: 96
Joined: Tue Sep 30, 2014 6:55 am

Re: [fixed] bpgdec.exe console flicker

Post by Marsu42 »

heimaki wrote:i'm not gonna bother with encoding (too many dependencies), but here's a x64 bit version of bpgdec.exe 0.9.7 with subsystem changed.
Thanks!
i doubt some format will take jpg's place the next years. they have only better quality by a very small margin, but are all a lot slower.
With medium compression, it's indeed difficult to see lossy bpg, webp or xr being a lot better than jpeg, only that they support alpha and some higher bitres... that's b/c jpeg is rather optimized by now and gives ok results. But I've done some tests myself with the usual suspect formats on my photography, and with higher compression lossy bpg completely crushes blocky jpeg, the lackluster lossy webp and esp. the ancient ms-hdphoto based xr, look at these samples: http://xooyoozoo.github.io/yolo-octo-bu ... pg=s&bpg=s

And if you go for near-lossless compression, bpg is noticeably better (i.e. smaller filesize) than the very good webp, which in turn outclasses xr and jp2. Of course with jpeg, the filesize of "lossless" are way loo large to write home about. ymmv. The one thing that will stop bpg in its tracks are the hevc patents which won't expire for a long time.
heimaki
Posts: 43
Joined: Thu Dec 27, 2012 8:04 pm

Re: [fixed] bpgdec.exe console flicker

Post by heimaki »

i compiled libbpg-0.9.7.tar.gz but there seems to be something wrong?
# Enable compilation of Javascript decoder with Emscripten
#USE_EMCC=y
# Enable x265 for the encoder
USE_X265=y
# Enable the JCTVC code (best quality but slow) for the encoder
USE_JCTVC=y
# Compile bpgview (SDL and SDL_image libraries needed)
# USE_BPGVIEW=y
# Enable it to use bit depths > 12 (need more tests to validate encoder)
USE_JCTVC_HIGH_BIT_DEPTH=y
# Enable the cross compilation for Windows
CONFIG_WIN32=y
# Enable for compilation on MacOS X
#CONFIG_APPLE=y
although i have JCTVC enabled (it compiled and i got a libjctvc.a) my bpgenc.exe tells me there is only x265 available...

the same is true for the official bpg-0.9.6-win64.zip from http://bellard.org/bpg
no JCTVC there.

if i compile it with USE_JCTVC disabled, the filesize is smaller, as expected. so JCTVC clearly gets linked in, but still bpgenc.exe refuses to use it.
or am i missing something here?
Marsu42
Posts: 96
Joined: Tue Sep 30, 2014 6:55 am

Re: [fixed] bpgdec.exe console flicker

Post by Marsu42 »

heimaki wrote:if i compile it with USE_JCTVC disabled, the filesize is smaller, as expected. so JCTVC clearly gets linked in, but still bpgenc.exe refuses to use it.
or am i missing something here?
When I compiled bpgenc I discovered that even complete out-of-the-box compilation is broken for jctvc, it throws some errors in the glue files. At least with my environment (cygwin64 with mingw-x86_64 target)... I guess there's a reason why even the author's binaries have only x265 enabled :-\

I'd love to have the most recent bpg with both encoders enabled b/c the author writes that lossless compression is supposed to be better in jctvc. Btw updating the included jctvc encoder with a newer one causes complete havoc, but you can safely replace x265 with the newest version which includes some patches that matter here.

Last not least, IrfanView's built-in bpg is *much* faster than XnView, I hope someone is able to wrap bpg into a dll for XnView sooner or later, too. If patents are an issue, it's not like it has to be released in the main package an could be downloaded god-knows-where-maybe-Russia-or-the-like.
Post Reply