Skip to content

Commit

Permalink
VIDEO: Allow AVI tracks to be dithered via the Codec
Browse files Browse the repository at this point in the history
Video for Windows made the Codec do the dithering work
  • Loading branch information
Matthew Hoops committed Apr 11, 2015
1 parent f6d7c5e commit cfc6415
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
24 changes: 24 additions & 0 deletions video/avi_decoder.cpp
Expand Up @@ -815,6 +815,30 @@ void AVIDecoder::AVIVideoTrack::forceTrackEnd() {
_curFrame = _frameCount - 1;
}

const byte *AVIDecoder::AVIVideoTrack::getPalette() const {
if (_videoCodec && _videoCodec->containsPalette())
return _videoCodec->getPalette();

_dirtyPalette = false;
return _palette;
}

bool AVIDecoder::AVIVideoTrack::hasDirtyPalette() const {
if (_videoCodec && _videoCodec->containsPalette())
return _videoCodec->hasDirtyPalette();

return _dirtyPalette;
}

bool AVIDecoder::AVIVideoTrack::canDither() const {
return _videoCodec && _videoCodec->canDither();
}

void AVIDecoder::AVIVideoTrack::setDither(const byte *palette) {
assert(_videoCodec);
_videoCodec->setDither(palette);
}

AVIDecoder::AVIAudioTrack::AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType)
: _audsHeader(streamHeader), _wvInfo(waveFormat), _soundType(soundType), _curChunk(0) {
_audStream = createAudioStream();
Expand Down
7 changes: 5 additions & 2 deletions video/avi_decoder.h
Expand Up @@ -179,11 +179,14 @@ class AVIDecoder : public VideoDecoder {
int getCurFrame() const { return _curFrame; }
int getFrameCount() const { return _frameCount; }
const Graphics::Surface *decodeNextFrame() { return _lastFrame; }
const byte *getPalette() const { _dirtyPalette = false; return _palette; }
bool hasDirtyPalette() const { return _dirtyPalette; }

const byte *getPalette() const;
bool hasDirtyPalette() const;
void setCurFrame(int frame) { _curFrame = frame; }
void loadPaletteFromChunk(Common::SeekableReadStream *chunk);
void useInitialPalette();
bool canDither() const;
void setDither(const byte *palette);

bool isTruemotion1() const;
void forceDimensions(uint16 width, uint16 height);
Expand Down

0 comments on commit cfc6415

Please sign in to comment.