CVMetalTextureCacheCreateTextureFromImage - pixelFormat
up vote
0
down vote
favorite
From the tests I did, the pixelFormat parameter of CVMetalTextureCacheCreateTextureFromImage is the pixel format of the metal texture and not the actual pixel format of data in the Cove Video buffer. Is this right?
In that case, where and when the conversion is done (if the texture and buffer formats are different)? Is there any performance penallity for that conversion?
EDIT:
I rechecked documentation and the pixelFormat parameter is described as follow: "The Metal pixel format constant describing the image buffer’s "data. So the pixelFormat should match the pixel format of the Core Video buffer data, no?
However, for the same Core Video buffer (whichcontains integer data), it works if I use either MTLPixelFormatR8Uint or MTLPixelFormatR8Unorm. The only difference is that the values received in my shader are either integers [0..255] or floats [0.0..1.0]. In the later case, I would have expected to receive garbage since the intergers is the buffer would have been interpreted as floats. No?
ios textures metal
|
show 1 more comment
up vote
0
down vote
favorite
From the tests I did, the pixelFormat parameter of CVMetalTextureCacheCreateTextureFromImage is the pixel format of the metal texture and not the actual pixel format of data in the Cove Video buffer. Is this right?
In that case, where and when the conversion is done (if the texture and buffer formats are different)? Is there any performance penallity for that conversion?
EDIT:
I rechecked documentation and the pixelFormat parameter is described as follow: "The Metal pixel format constant describing the image buffer’s "data. So the pixelFormat should match the pixel format of the Core Video buffer data, no?
However, for the same Core Video buffer (whichcontains integer data), it works if I use either MTLPixelFormatR8Uint or MTLPixelFormatR8Unorm. The only difference is that the values received in my shader are either integers [0..255] or floats [0.0..1.0]. In the later case, I would have expected to receive garbage since the intergers is the buffer would have been interpreted as floats. No?
ios textures metal
MTLPixelFormatR8Unorm
interprets the data as unsigned integers and then converts them to floats in the range [0.0..1.0]. It does not expect the data to already be some 8-bit floating-point type.
– Ken Thomases
2 days ago
So pixelFormat is not the format of the Core Video buffer data as described by the documentation, right? Also, Is there any performance penalty for that conversion? From what I recall, conversion from integer to float are free when done in the shader.
– Yoshi
2 days ago
It is the format of the Core Video buffer data. What did I say that implied otherwise? BothMTLPixelFormatR8Uint
andMTLPixelFormatR8Unorm
say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]. It's just that, in shaders, unsigned normalized values are presented as floating-point values. That doesn't affect what's in the buffer data. I don't know for sure about a performance penalty, but 8-bitUnorm
formats are very common for rendering, so they're presumably plenty fast.
– Ken Thomases
2 days ago
If the difference between MTLPixelFormatR8Uint and MTLPixelFormatR8Unorm is not the buffer data type (both say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]) but rather how the MTLTexture outputs its values, isn't correct to says that the pixelFormat parameter describe the pixel format (or the output) of the MTLTexture?
– Yoshi
2 days ago
Ok, I think I got it... both those format doesn't says how The MTLTexture should output its values but they rather says how the 8-bit interger values in the buffer should be interpreted (i.e. their format).. For Uint, it mean that 255 is 255 and for Unorm, 255 mean max range and thus 1.0. I got it?
– Yoshi
2 days ago
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
From the tests I did, the pixelFormat parameter of CVMetalTextureCacheCreateTextureFromImage is the pixel format of the metal texture and not the actual pixel format of data in the Cove Video buffer. Is this right?
In that case, where and when the conversion is done (if the texture and buffer formats are different)? Is there any performance penallity for that conversion?
EDIT:
I rechecked documentation and the pixelFormat parameter is described as follow: "The Metal pixel format constant describing the image buffer’s "data. So the pixelFormat should match the pixel format of the Core Video buffer data, no?
However, for the same Core Video buffer (whichcontains integer data), it works if I use either MTLPixelFormatR8Uint or MTLPixelFormatR8Unorm. The only difference is that the values received in my shader are either integers [0..255] or floats [0.0..1.0]. In the later case, I would have expected to receive garbage since the intergers is the buffer would have been interpreted as floats. No?
ios textures metal
From the tests I did, the pixelFormat parameter of CVMetalTextureCacheCreateTextureFromImage is the pixel format of the metal texture and not the actual pixel format of data in the Cove Video buffer. Is this right?
In that case, where and when the conversion is done (if the texture and buffer formats are different)? Is there any performance penallity for that conversion?
EDIT:
I rechecked documentation and the pixelFormat parameter is described as follow: "The Metal pixel format constant describing the image buffer’s "data. So the pixelFormat should match the pixel format of the Core Video buffer data, no?
However, for the same Core Video buffer (whichcontains integer data), it works if I use either MTLPixelFormatR8Uint or MTLPixelFormatR8Unorm. The only difference is that the values received in my shader are either integers [0..255] or floats [0.0..1.0]. In the later case, I would have expected to receive garbage since the intergers is the buffer would have been interpreted as floats. No?
ios textures metal
ios textures metal
asked 2 days ago
Yoshi
517
517
MTLPixelFormatR8Unorm
interprets the data as unsigned integers and then converts them to floats in the range [0.0..1.0]. It does not expect the data to already be some 8-bit floating-point type.
– Ken Thomases
2 days ago
So pixelFormat is not the format of the Core Video buffer data as described by the documentation, right? Also, Is there any performance penalty for that conversion? From what I recall, conversion from integer to float are free when done in the shader.
– Yoshi
2 days ago
It is the format of the Core Video buffer data. What did I say that implied otherwise? BothMTLPixelFormatR8Uint
andMTLPixelFormatR8Unorm
say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]. It's just that, in shaders, unsigned normalized values are presented as floating-point values. That doesn't affect what's in the buffer data. I don't know for sure about a performance penalty, but 8-bitUnorm
formats are very common for rendering, so they're presumably plenty fast.
– Ken Thomases
2 days ago
If the difference between MTLPixelFormatR8Uint and MTLPixelFormatR8Unorm is not the buffer data type (both say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]) but rather how the MTLTexture outputs its values, isn't correct to says that the pixelFormat parameter describe the pixel format (or the output) of the MTLTexture?
– Yoshi
2 days ago
Ok, I think I got it... both those format doesn't says how The MTLTexture should output its values but they rather says how the 8-bit interger values in the buffer should be interpreted (i.e. their format).. For Uint, it mean that 255 is 255 and for Unorm, 255 mean max range and thus 1.0. I got it?
– Yoshi
2 days ago
|
show 1 more comment
MTLPixelFormatR8Unorm
interprets the data as unsigned integers and then converts them to floats in the range [0.0..1.0]. It does not expect the data to already be some 8-bit floating-point type.
– Ken Thomases
2 days ago
So pixelFormat is not the format of the Core Video buffer data as described by the documentation, right? Also, Is there any performance penalty for that conversion? From what I recall, conversion from integer to float are free when done in the shader.
– Yoshi
2 days ago
It is the format of the Core Video buffer data. What did I say that implied otherwise? BothMTLPixelFormatR8Uint
andMTLPixelFormatR8Unorm
say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]. It's just that, in shaders, unsigned normalized values are presented as floating-point values. That doesn't affect what's in the buffer data. I don't know for sure about a performance penalty, but 8-bitUnorm
formats are very common for rendering, so they're presumably plenty fast.
– Ken Thomases
2 days ago
If the difference between MTLPixelFormatR8Uint and MTLPixelFormatR8Unorm is not the buffer data type (both say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]) but rather how the MTLTexture outputs its values, isn't correct to says that the pixelFormat parameter describe the pixel format (or the output) of the MTLTexture?
– Yoshi
2 days ago
Ok, I think I got it... both those format doesn't says how The MTLTexture should output its values but they rather says how the 8-bit interger values in the buffer should be interpreted (i.e. their format).. For Uint, it mean that 255 is 255 and for Unorm, 255 mean max range and thus 1.0. I got it?
– Yoshi
2 days ago
MTLPixelFormatR8Unorm
interprets the data as unsigned integers and then converts them to floats in the range [0.0..1.0]. It does not expect the data to already be some 8-bit floating-point type.– Ken Thomases
2 days ago
MTLPixelFormatR8Unorm
interprets the data as unsigned integers and then converts them to floats in the range [0.0..1.0]. It does not expect the data to already be some 8-bit floating-point type.– Ken Thomases
2 days ago
So pixelFormat is not the format of the Core Video buffer data as described by the documentation, right? Also, Is there any performance penalty for that conversion? From what I recall, conversion from integer to float are free when done in the shader.
– Yoshi
2 days ago
So pixelFormat is not the format of the Core Video buffer data as described by the documentation, right? Also, Is there any performance penalty for that conversion? From what I recall, conversion from integer to float are free when done in the shader.
– Yoshi
2 days ago
It is the format of the Core Video buffer data. What did I say that implied otherwise? Both
MTLPixelFormatR8Uint
and MTLPixelFormatR8Unorm
say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]. It's just that, in shaders, unsigned normalized values are presented as floating-point values. That doesn't affect what's in the buffer data. I don't know for sure about a performance penalty, but 8-bit Unorm
formats are very common for rendering, so they're presumably plenty fast.– Ken Thomases
2 days ago
It is the format of the Core Video buffer data. What did I say that implied otherwise? Both
MTLPixelFormatR8Uint
and MTLPixelFormatR8Unorm
say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]. It's just that, in shaders, unsigned normalized values are presented as floating-point values. That doesn't affect what's in the buffer data. I don't know for sure about a performance penalty, but 8-bit Unorm
formats are very common for rendering, so they're presumably plenty fast.– Ken Thomases
2 days ago
If the difference between MTLPixelFormatR8Uint and MTLPixelFormatR8Unorm is not the buffer data type (both say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]) but rather how the MTLTexture outputs its values, isn't correct to says that the pixelFormat parameter describe the pixel format (or the output) of the MTLTexture?
– Yoshi
2 days ago
If the difference between MTLPixelFormatR8Uint and MTLPixelFormatR8Unorm is not the buffer data type (both say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]) but rather how the MTLTexture outputs its values, isn't correct to says that the pixelFormat parameter describe the pixel format (or the output) of the MTLTexture?
– Yoshi
2 days ago
Ok, I think I got it... both those format doesn't says how The MTLTexture should output its values but they rather says how the 8-bit interger values in the buffer should be interpreted (i.e. their format).. For Uint, it mean that 255 is 255 and for Unorm, 255 mean max range and thus 1.0. I got it?
– Yoshi
2 days ago
Ok, I think I got it... both those format doesn't says how The MTLTexture should output its values but they rather says how the 8-bit interger values in the buffer should be interpreted (i.e. their format).. For Uint, it mean that 255 is 255 and for Unorm, 255 mean max range and thus 1.0. I got it?
– Yoshi
2 days ago
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418065%2fcvmetaltexturecachecreatetexturefromimage-pixelformat%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
MTLPixelFormatR8Unorm
interprets the data as unsigned integers and then converts them to floats in the range [0.0..1.0]. It does not expect the data to already be some 8-bit floating-point type.– Ken Thomases
2 days ago
So pixelFormat is not the format of the Core Video buffer data as described by the documentation, right? Also, Is there any performance penalty for that conversion? From what I recall, conversion from integer to float are free when done in the shader.
– Yoshi
2 days ago
It is the format of the Core Video buffer data. What did I say that implied otherwise? Both
MTLPixelFormatR8Uint
andMTLPixelFormatR8Unorm
say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]. It's just that, in shaders, unsigned normalized values are presented as floating-point values. That doesn't affect what's in the buffer data. I don't know for sure about a performance penalty, but 8-bitUnorm
formats are very common for rendering, so they're presumably plenty fast.– Ken Thomases
2 days ago
If the difference between MTLPixelFormatR8Uint and MTLPixelFormatR8Unorm is not the buffer data type (both say that the buffer data consists of 8-bit unsigned integers in the range from [0..255]) but rather how the MTLTexture outputs its values, isn't correct to says that the pixelFormat parameter describe the pixel format (or the output) of the MTLTexture?
– Yoshi
2 days ago
Ok, I think I got it... both those format doesn't says how The MTLTexture should output its values but they rather says how the 8-bit interger values in the buffer should be interpreted (i.e. their format).. For Uint, it mean that 255 is 255 and for Unorm, 255 mean max range and thus 1.0. I got it?
– Yoshi
2 days ago