Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null image input & output #1776

Merged
merged 3 commits into from
Oct 5, 2017
Merged

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Oct 3, 2017

This I/O plugin for "null" images are a file "format" where output of a null file does nothing at all (no I/O, not even any data copying), and input of a null file just fills the result buffers with black pixels (0 values), with no I/O or data copying.

What's this good for?

  • Benchmarking, if you want to have OIIO's input or output truly take as close to no time whatsoever.

  • "Dry run" of applications where you don't want it to produce any real output (akin to a Unix command that you redirect output to /dev/null).

  • Make "fake" input that looks like a file, but the file doesn't exist (if you are happy with constant-colored pixels).

The filename allows a REST-ful syntax, where you can append little doodads that specify things like resolution (of the non-existent file), etc. For example,

    foo.null?RES=640x480&CHANNELS=3

would specify a null file with resolution 640x480 and 3 channels. Token/value pairs accepted are

    RES=1024x1024        set resolution (3D example: 256x256x100)
    CHANNELS=4           set number of channels
    TILES=64x64          makes it look like a tiled image with tile size
    TYPE=uint8           set the pixel data type
    PIXEL=r,g,b,...      set pixel values (comma separates channel values)
    TEX=1                make it look like a full MIP-mapped texture
    attrib=value         anything else will set metadata!

Along the way, I also made some tweaks to ImageInput::create() to correctly disassemble the RESTful filename to figure out the extension (and thus which II plugin to use, without having to try them all).

@lgritz lgritz force-pushed the lg-null branch 2 times, most recently from f25e83c to 0897e68 Compare October 3, 2017 23:13
This I/O plugin for "null" images are a file "format" where output of a
null file does nothing at all (no I/O, not even any data copying), and
input of a null file just fills the result buffers with black pixels (0
values), with no I/O or data copying.

What's this good for?

* Benchmarking, if you want to have OIIO's input or output truly take
  as close to no time whatsoever.

* "Dry run" of applications where you don't want it to produce any real
  output (akin to a Unix command that you redirect output to /dev/null).

* Make "fake" input that looks like a file, but the file doesn't exist
  (if you are happy with constant-colored pixels).

The filename allows a REST-ful syntax, where you can append little doodads
that specify things like resolution (of the non-existent file), etc.
For example,

    foo.null?RES=640x480&CHANNELS=3

would specify a null file with resolution 640x480 and 3 channels.
Token/value pairs accepted are

    RES=1024x1024        set resolution (3D example: 256x256x100)
    CHANNELS=4           set number of channels
    TILES=64x64          makes it look like a tiled image with tile size
    TYPE=uint8           set the pixel data type
    PIXEL=r,g,b,...      set pixel values (comma separates channel values)
    TEX=1                make it look like a full MIP-mapped texture
    attrib=value         anything else will set metadata!
@lgritz lgritz merged commit a5b934d into AcademySoftwareFoundation:master Oct 5, 2017
@lgritz lgritz deleted the lg-null branch October 5, 2017 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant