Comments (16)
A bit more investigation reveals that glCompressedTexSubImage2D fails with GL_INVALID_OPERATION.
I have also checked the list of supported compression formats using glGet GL_COMPRESSED_TEXTURE_FORMATS and it does indeed include GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
from ofxhapplayer.
Strange - AMD drivers up to date? Does this also happen with the ofxHapPlayer example app on the affected machine?
from ofxhapplayer.
Yes. It's a new computer with most recent drivers installed. And the issues is the same with the example app.
from ofxhapplayer.
I'm having the same strange issue. The issue only happens on AMD cards (i tried an RX 480 and R9 290), and it has not been an issue with the last versions of ofxHapPlayer. I have found that it is fixed by making the video dimensions divisible by 4. I had a 985 x 574 video that works fine on AMD cards if i scale it to 984 x 572. If i just make the dimensions even, it does not work.
from ofxhapplayer.
@sunekastbjerg ah - OK, helpful to know it works for multiples of 4. Could you try the following change to ofxHapPlayer.cpp, lines 546 onwards:
#if OFX_HAP_HAS_CODECPAR
ofxHapPY::roundUpToMultipleOf4(_videoStream->codecpar->width),
ofxHapPY::roundUpToMultipleOf4(_videoStream->codecpar->height),
#else
ofxHapPY::roundUpToMultipleOf4(_videoStream->codec->width),
ofxHapPY::roundUpToMultipleOf4(_videoStream->codec->height),
#endif
Then try playing an odd-dimensioned movie and report back. Thanks!
from ofxhapplayer.
just for clarity, the full function call there becomes
glCompressedTexSubImage2D(GL_TEXTURE_2D,
0,
0,
0,
#if OFX_HAP_HAS_CODECPAR
ofxHapPY::roundUpToMultipleOf4(_videoStream->codecpar->width),
ofxHapPY::roundUpToMultipleOf4(_videoStream->codecpar->height),
#else
ofxHapPY::roundUpToMultipleOf4(_videoStream->codec->width),
ofxHapPY::roundUpToMultipleOf4(_videoStream->codec->height),
#endif
internalFormat,
static_cast<GLsizei>(_decodedFrame.buffer.size()),
_decodedFrame.buffer.data());
from ofxhapplayer.
Thanks for the fast response! I'm getting an GL_INVALID_VALUE from glCompressedTexSubImage2D with those values. Don't we need to resize the buffer as well for that to work?
from ofxhapplayer.
The buffer is correctly sized because DXT data is always in 4x4 blocks even if some of the pixels are beyond the bounds of the image (drivers are expected to be able to handle odd widths in glCompressedTexSubImage2D, so this is a driver bug).
We probably need to allocate the texture with the same rounded dimensions - but we don't want OF to start drawing the full texture either. See if it works if you perform the same rounding at lines 513 onwards where we set the texture's dimensions - it's not a solution because you'll also see the extra pixels when you draw the texture, but we can force that if we discover this works.
from ofxhapplayer.
There is also the coded_width
and coded_height
parameters to reveal the actual dimensions of the data. They should be the same as multiple of four, but coded dimensions are more correct, right?
from ofxhapplayer.
@tobiasebsen from AVCodecContext
? We don't have one for the video stream.
from ofxhapplayer.
The buffer is correctly sized because DXT data is always in 4x4 blocks even if some of the pixels are beyond the bounds of the image (drivers are expected to be able to handle odd widths in glCompressedTexSubImage2D, so this is a driver bug).
We probably need to allocate the texture with the same rounded dimensions - but we don't want OF to start drawing the full texture either. See if it works if you perform the same rounding at lines 513 onwards where we set the texture's dimensions - it's not a solution because you'll also see the extra pixels when you draw the texture, but we can force that if we discover this works.
Just tried that out, and it seems to work with the odd sized textures when the allocation is rounded up to multiples of 4 as well. Thanks! :)
from ofxhapplayer.
@bangnoise you could just set the _texture.texData.width
and _texture.texData.height
to the non-rounded values after texture allocation to avoid drawing the extra pixels.
from ofxhapplayer.
... and, of cause, scale the tex_t
and tex_u
accordingly.
from ofxhapplayer.
#63 Like this ?
from ofxhapplayer.
Yes that is what i tried and it works on an AMD R9 290 at least. :)
from ofxhapplayer.
Fixed in #63 - thanks @tobiasebsen
from ofxhapplayer.
Related Issues (20)
- macOS 10.15 and OF 0.11 compile error HOT 8
- setFrame()? TODO HOT 1
- lower fps than ofxHAPAVPlayer with 10 x 4K
- Ringerbuffer clashes with ofxIO HOT 2
- INVALID OR CORRUPT FILE libavcodec.57.64.101.dylib HOT 4
- Exception from unique_lock in Demuxer.cpp HOT 5
- Sending video images to ofxCv HOT 1
- Libdispatch errors with GCC on some Linuxes HOT 4
- getTotalNumFrames() returns 0 HOT 4
- getWidth() and getHeight() return 0 HOT 2
- No PCM audio playback on OSX HOT 1
- Issue with multiple players HOT 6
- same video, asynchronous play
- Compiling on windows with qtcreator/msys2 HOT 1
- Error with @rpath/ffmpeg/lib/osx/libavutil.56.dylib
- Unable to pass ofxHapPlayer textures to a custom shader
- How to access Pixels still?
- It's possible to extract an image frame "offline" to generate thumbnails? HOT 1
- No sound on Windows...
- compatibility with ffmpeg 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ofxhapplayer.