aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2014-09-05 21:03:52 -0400
committerMatthew Hoops2015-04-11 14:37:04 -0400
commitb170b0882237a4c8b8119d2875bf2e05c03168e5 (patch)
tree4281696a403db82c7d9536e571365cfb6fa3dac2
parent1271fbde8f30fdf2d0664bb1e3382928380f9aa9 (diff)
downloadscummvm-rg350-b170b0882237a4c8b8119d2875bf2e05c03168e5.tar.gz
scummvm-rg350-b170b0882237a4c8b8119d2875bf2e05c03168e5.tar.bz2
scummvm-rg350-b170b0882237a4c8b8119d2875bf2e05c03168e5.zip
VIDEO: Add support for dithering in QuickTime videos
-rw-r--r--video/qt_decoder.cpp23
-rw-r--r--video/qt_decoder.h2
2 files changed, 25 insertions, 0 deletions
diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index 9b77ef70c1..cab7372a6d 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -751,4 +751,27 @@ bool QuickTimeDecoder::VideoTrackHandler::endOfCurEdit() const {
return getRateAdjustedFrameTime() >= getCurEditTimeOffset() + getCurEditTrackDuration();
}
+bool QuickTimeDecoder::VideoTrackHandler::canDither() const {
+ for (uint i = 0; i < _parent->sampleDescs.size(); i++) {
+ VideoSampleDesc *desc = (VideoSampleDesc *)_parent->sampleDescs[i];
+
+ if (!desc || !desc->_videoCodec)
+ return false;
+
+ if (!desc->_videoCodec->canDither(Image::Codec::kDitherTypeQT))
+ return false;
+ }
+
+ return true;
+}
+
+void QuickTimeDecoder::VideoTrackHandler::setDither(const byte *palette) {
+ assert(canDither());
+
+ for (uint i = 0; i < _parent->sampleDescs.size(); i++) {
+ VideoSampleDesc *desc = (VideoSampleDesc *)_parent->sampleDescs[i];
+ desc->_videoCodec->setDither(Image::Codec::kDitherTypeQT, palette);
+ }
+}
+
} // End of namespace Video
diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index 99ac9ff5f7..99980a303d 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -140,6 +140,8 @@ private:
bool hasDirtyPalette() const { return _curPalette; }
bool setReverse(bool reverse);
bool isReversed() const { return _reversed; }
+ bool canDither() const;
+ void setDither(const byte *palette);
Common::Rational getScaledWidth() const;
Common::Rational getScaledHeight() const;