52 Commits

Author SHA1 Message Date
sinamas
471d942549 common: drop use of WORDS_BIGENDIAN 2013-03-23 14:11:57 +01:00
sinamas
ed230c296a ringbuf: use array size in fill 2013-03-11 23:01:03 +01:00
sinamas
53e10b83ea defined_ptr: lower case defined_deleter 2013-03-10 18:52:15 +01:00
sinamas
81bd599064 common: add smart_ptr deleter template parameter 2013-03-10 18:25:30 +01:00
sinamas
af7a84b1b2 qpainterblitter: always use image back buffer
get rid of union.
avoid touching back buffer on resize.
lock-free resize.
2013-03-10 18:25:30 +01:00
sinamas
5c68d732da common/videolink: use ptrdiff_t to represent pitch 2013-02-26 19:44:27 +01:00
sinamas
c4b401436f common/polyphasefir: include order 2013-02-20 21:35:21 +01:00
sinamas
b8365b4429 common/linint: include order 2013-02-20 21:35:07 +01:00
sinamas
7d778308a8 common/rateest: formatting/readability 2013-02-20 21:11:17 +01:00
sinamas
44147181c0 common/adaptiveSleep: formatting/readability 2013-02-20 21:06:03 +01:00
sinamas
1a4b00bfb6 trailing whitespace 2013-02-20 20:05:25 +01:00
sinamas
379ef56791 common/chainresampler: include order 2013-02-20 19:43:33 +01:00
sinamas
c527c05010 common/chainresampler: formatting/readability 2013-02-20 19:43:14 +01:00
sinamas
18588cc717 usec: delete superflous noise 2013-02-11 20:57:59 +01:00
sinamas
ab1a26cedb common: more ideomatic use of sizeof 2013-02-11 20:12:41 +01:00
sinamas
f2c55cfa1b common: add poor man's unique_ptr
all in the name of not depending on tr1, c++11 or boost (stoneage c++98
ftw).

a marginal step up from std::auto_ptr but better than nothing imo.
2013-02-10 21:24:28 +01:00
sinamas
b480c28570 utilize defined_ptr
and prune some cruft.
2013-02-10 21:22:21 +01:00
sinamas
ab8f617632 common: add defined_ptr/poor mans boost::checked_delete 2013-02-10 12:00:09 +01:00
sinamas
f1aa6de424 s/aamas@stud.ntnu.no/sinamas@users.sourceforge.net/
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@359 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2012-10-28 18:32:38 +00:00
sinamas
e15b580b89 rgb32ToRgb16: save 1 instruction in inner-loop on ARM (gcc).
gcc is bad at folding shifts into ands (and probably other ops) with simple constants (it prefers using immediates, saving a register and reducing loop header).
help it fold shifts into the ors (non-constant, so gcc cannot pick the immediate version) instead.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@330 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2012-07-29 10:21:12 +00:00
sinamas
fe440c47a4 rgb32ToRgb16: a bit tighter
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@329 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2012-07-28 12:36:30 +00:00
sinamas
f3d875e288 index resamplers with size_t rather than unsigned int.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@322 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2012-07-10 22:54:03 +00:00
sinamas
09b949005d linint: faster (not that it matters). support in_rate < out_rate.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@321 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2012-07-09 17:21:50 +00:00
sinamas
18d200aa86 less template bloat
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@320 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2012-07-08 15:39:27 +00:00
sinamas
5ef2f3e0c2 polyphase fir: handle two channels at a time
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@319 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2012-07-07 16:24:46 +00:00
sinamas
c137c648a1 tweak for better gcc asm output.
fewer regs needed/less spilling. reduce number of redundant loads/stores.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@318 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2012-07-06 23:43:49 +00:00
sinamas
0b58c40c4b cic3: avoid crap gcc asm generation (x86)
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@317 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2012-07-06 16:50:32 +00:00
sinamas
a14a736f29 - compensate for cic gain < 1.0 by scaling up polyphase fir coefficients.
- avoid phase length < 4


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@315 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2012-07-04 18:10:14 +00:00
sinamas
5c52567a68 - missing explicit.
- missing [].


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@310 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-11-19 16:53:57 +00:00
sinamas
4dfff22e1e nitpick refactoring
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@298 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-11-09 19:47:44 +00:00
sinamas
a0b4f787b0 - explicit constructor.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@296 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-11-07 21:48:09 +00:00
sinamas
20199c537a - refactoring.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@295 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-11-07 21:34:50 +00:00
sinamas
bdbb19c1ee - Work around DWM compositor screwing up when duplicating frames by adding "DWM triple buffering" option (on by default) which sets presentparameters with frame queueing for all blitters.
- Work around DWM breaking windows with frame queuing after composition is disabled and re-enabled, by resetting present parameters on next video frame after composition enable event.
- Work around DWM breaking OpenGL window on minimize by unsetting present params on hide event, and setting on show event.
- Ignore sync to vblank when DWM composition is active.
- Deactivate sync to frame rate option when DWM composition is active.
- Make window size setting a menu rather than a part of video settings dialog.
- Work around Windows file dialog blocking events by waiting for pause to complete before launching such dialog.
- Work around events getting blocked when resizing on Windows by consuming pending blit requests on resizeEvent.
- WASAPI: Detect and use shared stream sampling rate in shared mode because all other rates appear to fail.
- Default screen names start at "1" rather than "0".
- Build fixes for mingw gcc 3.4.
- Refactoring.



git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@259 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-09-11 04:32:50 +00:00
sinamas
4b60088bc2 Add one level of unrolling to cic2.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@258 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-09-04 15:16:25 +00:00
sinamas
9f8c0a278f Allow intermediate polyphase sinc resamplers in a resampling chain to start/end (after fold) roll-off at limit of hearing if applicable, not just the final one.
Modify chain cost formulae and their derivatives for optimal ratios accordingly.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@257 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-09-01 21:21:17 +00:00
sinamas
61fc540ddb refactoring.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@256 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-08-25 17:35:27 +00:00
sinamas
cf1fe30715 refactoring.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@254 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-08-18 18:15:49 +00:00
sinamas
b3446fd934 - one more decimal position in refresh rate representation.
- use xrandr screen names
- hide empty full mode comboboxes
- windowed resolution -> window size
- lots of refactoring.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@247 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-08-01 06:01:08 +00:00
sinamas
50fd18dc93 Fix 2xSAI video filter reading out of bounds.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@244 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-01-04 18:33:14 +00:00
sinamas
82459cf24d - Document libgambatte better.
- Document resampling framework better.
- Use a single constant for setting number of resampler channels rather 
than two.
- thread-safety -> thread safety


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@239 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-04 00:14:08 +00:00
sinamas
3345e8ef21 - Move uncopyable.h to common.
- ScalingMethod header.
- length of video frame -> duration of video frame.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@238 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-03 20:00:38 +00:00
sinamas
629b35a30c - Move resample files around to separate interface files from
implementation files.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@236 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-02 23:09:04 +00:00
sinamas
470b627fa8 - Redesign Qt multimedia framework to use a worker thread for MediaSource updates. This was a ton of work, but should make underruns a lot less likely. The majority of
underruns are caused by video I/O blocking (even when not syncing to vblank). It also means that vsync blocking is a non-issue. Lots of thread-safety considerations had to 
be done. Lots of tools developed to deal with new problems. Things redesigned to be asynchronous to avoid blocking the worker thread. New interfaces developed to give 
clients access to these things without too much pain, as clients need to deal with thread-safety issues, and be able to do things asynchronously to avoid blocking and 
unnecessary synchronization. Things developed and then scrapped as I changed my mind. Lots of thinking and testing to ensure video smoothness.
- Make configuration of the multimedia framework way more flexible, by adding methods for configuring video and sound, rather than forcing the use of the SoundDialog or 
VideoDialog. Thus clients can make their own GUI for such things.
- Pass raw input events to MediaSources so that clients will not have to use the InputDialog with its Button system.
- Split BlitterWidget blitting into three methods: blit, draw, and sync, such that blitting is supposedly a fast pixel copy or buffer swap, while draw prepares for 
presentation, and sync presents the completed video frame ASAP. Blit needs to be fast to avoid blocking the worker thread to avoid underruns.
- Allow heavy MediaSource video work to be skipped when frames are skipped.
- Do some work in parallel on SMP systems.
- Adjust low audio buffer detection to make it more robust.
- Move variance calculation to the user of estimations, because the variance calculated by estimators is not well defined anyway.
- Add support for adjustable fast-forward speed.
- Fast-forward now outputs audio, by skipping entire segments of audio when skipping frames.
- Adjust blitters to conform to the new threaded model.
- Direct3DBlitter: Apparently vertices point to the center of pixels. Subtract 0.5 from vertex coordinates.
- DirectDrawBlitter: Sleep more when far from vblank.
- QGLBlitter: Get rid of makeCurrent calls, because they apparently block and can be slow and don't seem to be needed anyway. They also seem to cause instability with some 
drivers.
- XvBlitter: Double buffer to delay updates to sync time.
- X11Blitter: Double buffer when not scaling to delay updates to sync time.
- QPainterBlitter: Double buffer when not scaling to delay updates to sync time.
- SdlBlitter: Delay updates to sync time.
- AlsaEngine: Set max periods to 16 to work around stupid ALSA plugins and drivers that advertise smaller period sizes than properly supported. ALSA always picks the 
maximum number of periods allowed, which means it picks the smallest period size allowed for a given buffer size.
- QPainterBlitter: Don't disable updates when not paused, because this breaks macx.
- Support pause on focus out.
- Add MiscDialog to allow user configuration of fast-forward speed and focus policy.
- Separate sync to refresh rate logic from sync to vblank logic.
- Sync to refresh rate menu option.
- Use semi-bilinear filtering rather than bilinear filtering for soft-scaling blitters.
- MakeSincKernel: Consider rounding effects when computing absolute gain.
- MakeSincKernel: Use a function pointer rather than a template argument to reduce code bloat.
- Reorder sinc kernel phases.
- PolyPhaseConvoluter: Simplify some calculations.
- Replace Hamming and Blackman windowed sincs with Kaiser windowed sinc of appropriate betas, because they require a lower number of taps to achieve the same specs.
- Use rounding shifts in resamplers for higher precision and performance.
- libgambatte: Update returns on video frame completion rather than using a callback for notification.
- libgambatte: Move video filters and color conversion out of the library.
- libgambatte: Get rid of unnecessarily complex VideoBlitter interface.
- libgambatte: Use bit flags rather bools for input state.
- Change some parameters to constants in 2xsai and hqx video filters.
- Probably other stuff I've forgotten about.



git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@234 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-02 21:30:46 +00:00
sinamas
351359802b - RateEst: Add a convenient way of filtering measures that extend beyond a buffer time, and are as such
probably invalid.
- RateEst: Allow using a custom timestamp in feed().
- RateEst: Keep a queue of the last ~100 msec worth of samples and duration, and filter out collective
  samples that give a pre-estimate that seems way off.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@215 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-09 02:07:33 +00:00
sinamas
9932b1f4ac Substantially improved rate estimation averaging.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@204 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-12-25 23:45:53 +00:00
sinamas
640cd37feb Allow more rate estimation deviation.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@198 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-27 12:36:08 +00:00
sinamas
9feeeed04d - Add CoreAudio engine with rate estimation and buffer status support. Default engine on Mac OS X.
- 44100 Hz default sample rate on OS X, since OS X tends to resample everything to 44100 Hz.
- Get rid of buffer status averaging in OpenAlEngine, since it makes assumptions on usage pattern that shouldn't be made.
- Extend ringbuffer.h to support resetting size, and move it to common dir since gambatte_qt/coreaudioengine uses it too now.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@185 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-24 02:51:13 +00:00
sinamas
e42aa432d2 Fractional bits for intermediate rate estimation averages.
Add RateEst reset method. Initialize RateEst count to 1.
Less refresh rate estimation averaging.
Allow more refresh rate estimation deviation.
Return NULL paintEngine in windows blitters that use the PaintToScreen attribute.
Add checks for things not being initialized in DirectDraw-blitter and QPainterBlitter paintEvents.
Don't reparent blitters (mainly to make a bug in Qt 4.4.3 win less annoying, widgets that do internal reparenting are still affected).
Check for window position less than screen top-left after mode change, before full screen, to avoid Qt moving it to the primary screen.
Add rate estimation to DirectSound engine.
Better underrun detection in DirectSound engine.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@182 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-19 20:24:27 +00:00
sinamas
a82feb13c6 Stricter estimate deviation limit
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@171 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-16 01:44:18 +00:00
sinamas
1ba0fae6fa More averaging in estimation code.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@170 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-15 02:04:15 +00:00