Hacker Newsnew | past | comments | ask | show | jobs | submit | mmozeiko's commentslogin

From what I understand from code those unwarps are just doing matrix multiply to get unwraped pixel location? In this case doing these operations directly in fragment shader instead of texture lookup will be faster. Memory bandwidth is not free. But simple ALU like this (just couple FMA's) can easily hide in shadow of texture sampling that happens afterwards. So simply upload those undistortion matrices (mat1 & mat2) as uniforms and do matrix multiply in shader for adjusting texcoords.


map1 and map2 are the same dimensions as the video image.


Ah, I see. Yeah, then the current approach is fine.


There's also Windows.Graphics.Capture. It allows to get texture not only for whole desktop, but just individual windows.


I don't know why Signal calls it "DRM" because the do not use DRM for this. Typically DRM means encryption & keys are involved (which is what Netflix & others are doing with Widevine or PlayReady).

All Signal does is just a simple Windows API call to exclude window from screen capture. SetWindowDisplayAffinity function with WDA_EXCLUDEFROMCAPTURE argument: https://learn.microsoft.com/en-us/windows/win32/api/winuser/...


And Microsoft, literally call it the DRM flag. DRM doesn't insist on being encrypted.

https://learn.microsoft.com/en-us/windows/client-management/...

And that "simple Windows API" call is pretty much absolute, since it's across the stack.


Thanks for the insight, I thought they took advantage of the whole DRM stack (including HDCP in monitors) to encrypt the UI and let the monitor decrypt it.


If you change logic and/or to bitwise and/or then it'll be branchless.


True: https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename... but I understood hoten to be saying that compilers would generally produce that version from the short-circuiting version, and they don't.


Yeah I was wrong.

Do we know why the compiler doesn't do it? Surely the output is the same and avoiding branches is clearly faster.

Maybe short circuiting requires such an optimization not be made?


There are cases where the optimization wouldn't be safe (like i < n && a[i] != k) but this is not one of them. Maybe the compiler is just dum. Or maybe avoiding branches is not clearly faster in cases like this? Have you measured this particular case?


https://github.com/veluca93/fpnge is a very fast png encoder. A bit lower compression ratio, but runs significantly faster than alternatives. Here is a presentation with benchmarks:

https://www.lucaversari.it/FJXL_and_FPNGE.pdf


This worked out for me. What I was actually interested in was reducing CPU utilization, which generally speed is a fine substitute for (the same work being done in a smaller time slice means lower overall utilization). It reduced utilization enough that I'll likely push to use it for production in the future (not immediately, there's bigger low hanging fruit).


This looks right up my alley, thanks! Will give it a shot.


There is a simple way to get that immediate from expression you want to calculate. For example, if you want to calculate following expression:

    (NOT A) OR ((NOT B) XOR (C AND A))
then you simply write

    ~_MM_TERNLOG_A | (~_MM_TERNLOG_B ^ (_MM_TERNLOG_C & _MM_TERNLOG_A))
Literally the expression you want to calculate. It evaluates to immediate from _MM_TERNLOG_A/B/C constants defined in intrinsic headers, at least for gcc & clang:

    typedef enum {
      _MM_TERNLOG_A = 0xF0,
      _MM_TERNLOG_B = 0xCC,
      _MM_TERNLOG_C = 0xAA
    } _MM_TERNLOG_ENUM;
For MSVC you define them yourself.


To take the magic away, write it in binary:

  A = 0b11110000
  B = 0b11001100
  C = 0b10101010


The Amiga manual suggests normalizing to a conjunctive normal form.


The constant-math method above doesn't require that and works on denormalized expressions, too.

That said, the trick for turning four or more argument bitwise operations into a series of vpternlogd operations has yet to be posted


Suppose you have four boolean variables A, B, C, and D. You can calculate X as the result from A, B, C assuming that D is false, and Y as the result assuming that D is true. Then, a third ternary operation can switch between X and Y depending on D. This creates a tree of 3 operations, which I suspect is the best you can do in the worst case.

For five or more arguments, this naturally extends into a tree, though it likely isn't the most efficient encoding.


Unfortunately not everything. For example, no xbox 360 controller support: https://github.com/microsoft/GDK/issues/39



Thanks for the pointer!


I recommend Polygon as virtual filesystem for SQLite database files: https://plugring.farmanager.com/plugin.php?l=en&pid=973

PortaDev for accessing MTP mounts (like Android): https://plugring.farmanager.com/plugin.php?l=en&pid=933

DiskMenu for adding custom locations in Alt+F1/F2 menus: https://sourceforge.net/projects/farplugs/files/DiskMenu/

And if you're running Far under ConEmu, copy ConEmu\Plugins\ConEmu folder into Far's Plugins folder. It will do better integration with ConEmu (there will be bunch of new ConEmu related features under F11 menu in Far).


Make sure you run wxgtk build, not the terminal one. Terminal is limited on what shortcuts it can do. But wxgtk build runs exactly as windows counterpart - Alt+F1/F2 and many other shortcuts work fine.


Do you need to self compile? The Linux port (https://github.com/elfmz/far2l) ironically only provides macOS releases... Thank you!


On Ubuntu this seems to be official (?) ppa: https://launchpad.net/~far2l-team/+archive/ubuntu/ppa Make sure "far2l-gui" is installed.

On ArchLinux there's package in AUR: https://aur.archlinux.org/packages/far2l-git (I maintain it).

Don't know details for other distros.


Thank you! On Debian i have found the far2l which seems to work. I am trying to see if far can be a replacement for mc, which has been my goto terminal manager... and i like some of the shortcuts there... like <ctrl>-s and start typing (seems that on far, one can press <esc> and start typing for the same. I have not yet figured out how to (easily) get a file name to the command line or how to make vim the default editor when pressing F4...


Ctrl + "[" , Ctrl + "]" - bring the full path in the left panel or the right panel respectively into the command line (so Ctrl"+"[" and then Ctrl+Enter will bring full file path of the file under the cursor into the command line)

Ctrl + PgUp - move up the folder tree

Ctrl + U - swap panels (so the cursor goes from one panel to another, useful when you operate in 2 folders primarily, saves you an Alt+Tab)

Ctrl + LeftArrow, Ctrl + RightArrow - makes one of the panels larger or smaller

Ctrl + 1,2,3,5 - change panel layout (file name 1 column, file name 2 columns, file name with attributes, file name with more attributes)

etc. There's a lot. Not even mentioning all the plugins built in the last 20 years.

Fun fact: it was written by a 24 yo college student (graduate?..) from Chelyabinsk and was pretty much functionally complete couple years later. The same guy who designed RAR file format and built WinRar around the same time.


Thank you! Much appreciated!

mc has a "list of bookmarked directories", does far supports such a feature, with a shortcut to bring up the dialog to choose an entry from the list? I haven't found such thing... Only to have particular single directory on a shortcut, which means that I would have to remember the number corresponding to each path...


The closest would probably be FAR menu (F2) where menu options can be edited; you can probably just do "cd [name]" for menu options. I believe there's also history of commands issued in "Alt+F8". So... kinda.


Alt + start typing jumps to file/folder with this name.

Ctrl + enter puts currently selected file/folder name into command-line.

Ctrl + O hides panels and shows you "background" with all the previous command outputs.

Custom editor can be set in F9 -> Options -> Editor settings.


Far Manager is one of my "must to have apps" when working on Windows. These days I mostly work on mac and nice to know someone ported it.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: