[Scummvm-git-logs] scummvm master -> 9a1aff9cf4ad426b3a3638e2ae1de74aaf291b80

sev- noreply at scummvm.org
Mon Feb 21 21:19:53 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9a1aff9cf4 JANITORIAL: Fix indentation


Commit: 9a1aff9cf4ad426b3a3638e2ae1de74aaf291b80
    https://github.com/scummvm/scummvm/commit/9a1aff9cf4ad426b3a3638e2ae1de74aaf291b80
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-02-21T22:19:37+01:00

Commit Message:
JANITORIAL: Fix indentation

Changed paths:
    video/paco_decoder.cpp
    video/paco_decoder.h


diff --git a/video/paco_decoder.cpp b/video/paco_decoder.cpp
index 0e90dd39371..7fa1e14c727 100644
--- a/video/paco_decoder.cpp
+++ b/video/paco_decoder.cpp
@@ -47,19 +47,19 @@ bool PacoDecoder::loadStream(Common::SeekableReadStream *stream) {
 	stream->readUint16BE(); // 1
 	stream->readUint16BE(); // 0x26
 
-    uint16 width = stream->readUint16BE();
-    uint16 height = stream->readUint16BE();
-    int16 frameRate = stream->readUint16BE(); 
-    frameRate = ABS(frameRate); // Negative framerate is indicative of audio, but not always
+	uint16 width = stream->readUint16BE();
+	uint16 height = stream->readUint16BE();
+	int16 frameRate = stream->readUint16BE();
+	frameRate = ABS(frameRate); // Negative framerate is indicative of audio, but not always
 	uint16 flags = stream->readUint16BE();
-    bool hasAudio = (flags & 0x100) == 0x100;
+	bool hasAudio = (flags & 0x100) == 0x100;
 
 	stream->readUint32BE(); // maxChunksize
-    stream->readUint32BE(); // always 0
+	stream->readUint32BE(); // always 0
 	stream->readUint32BE(); // audio related flags
-    uint16 frameCount = stream->readUint16BE();
+	uint16 frameCount = stream->readUint16BE();
 	stream->readUint16BE(); // copy of frameCount
-    stream->readUint16BE(); // always 8?
+	stream->readUint16BE(); // always 8?
 	stream->readUint16BE(); // always 0x600?
 	stream->readUint32BE(); // flags
 	stream->readUint16BE(); // 0
@@ -93,7 +93,7 @@ void PacoDecoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
 
 PacoDecoder::PacoVideoTrack::PacoVideoTrack(
 	Common::SeekableReadStream *stream, uint16 frameRate, uint16 frameCount, bool hasAudio, uint16 width, uint16 height) {
-	
+
 	_fileStream = stream;
 	_frameDelay = 1000 / frameRate; // frameRate is in fps, ms per frame
 	_frameCount = frameCount;
@@ -101,15 +101,15 @@ PacoDecoder::PacoVideoTrack::PacoVideoTrack(
 	_surface = new Graphics::Surface();
 	_surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
 	_palette = new byte[3 * 256]();
-    memcpy(_palette, quickTimeDefaultPalette256, 256 * 3);
+	memcpy(_palette, quickTimeDefaultPalette256, 256 * 3);
 	_dirtyPalette = false;
 
 	_curFrame = 0;
 	_nextFrameStartTime = 0;
 
-    for (uint i = 0; i < _frameCount; i++) {
-        _frameSizes[i] = stream->readUint32BE();
-    }
+	for (uint i = 0; i < _frameCount; i++) {
+		_frameSizes[i] = stream->readUint32BE();
+	}
 }
 
 PacoDecoder::PacoVideoTrack::~PacoVideoTrack() {
@@ -138,49 +138,49 @@ Graphics::PixelFormat PacoDecoder::PacoVideoTrack::getPixelFormat() const {
 
 
 enum frameTypes {
-    NOP = 0, // nop
-    // 1 - old initialisation data?
-    PALLETE = 2, // - new initialisation data (usually 0x30 0x00 0x00 ... meaning 8-bit with default QuickTime palette)
-    DELAY = 3, //  - delay information
-    AUDIO = 4, // - audio data (8-bit unsigned PCM)
-    // 5 - should not be present
-    // 6 - should not be present
-    // 7 - unknown
-    VIDEO = 8, // - video frame
-    // 9 - unknown
-    // 10 - dummy?
-    EOC = 11 // - end of chunk marker
+	NOP = 0, // nop
+	// 1 - old initialisation data?
+	PALLETE = 2, // - new initialisation data (usually 0x30 0x00 0x00 ... meaning 8-bit with default QuickTime palette)
+	DELAY = 3, //  - delay information
+	AUDIO = 4, // - audio data (8-bit unsigned PCM)
+	// 5 - should not be present
+	// 6 - should not be present
+	// 7 - unknown
+	VIDEO = 8, // - video frame
+	// 9 - unknown
+	// 10 - dummy?
+	EOC = 11 // - end of chunk marker
 };
 
 const Graphics::Surface *PacoDecoder::PacoVideoTrack::decodeNextFrame() {
-    uint32 nextFrame = _fileStream->pos() + _frameSizes[_curFrame];
-	
-    debug(" frame %3d size %d @ %lX", _curFrame, _frameSizes[_curFrame], _fileStream->pos());
+	uint32 nextFrame = _fileStream->pos() + _frameSizes[_curFrame];
+
+	debug(" frame %3d size %d @ %lX", _curFrame, _frameSizes[_curFrame], _fileStream->pos());
 
 	while (_fileStream->pos() < nextFrame) {
-        int64 currentPos = _fileStream->pos();
-        int frameType = _fileStream->readByte();
-        int v = _fileStream->readByte();
-        uint32 chunkSize =  (v << 16 ) | _fileStream->readUint16BE();
-        debug("  slot type %d size %d @ %lX", frameType, chunkSize, _fileStream->pos() - 4);
+		int64 currentPos = _fileStream->pos();
+		int frameType = _fileStream->readByte();
+		int v = _fileStream->readByte();
+		uint32 chunkSize =  (v << 16 ) | _fileStream->readUint16BE();
+		debug("  slot type %d size %d @ %lX", frameType, chunkSize, _fileStream->pos() - 4);
 
 		switch (frameType) {
 		case AUDIO:
 			warning("PacoDecode::decodeFrame(): Audio not implemented");
-            break;
+			break;
 		case VIDEO:
 			handleFrame(chunkSize - 4);
 			break;
-        case PALLETE:
-            warning("PacoDecode::decodeFrame(): Palette not implemented");
-            break;
+		case PALLETE:
+			warning("PacoDecode::decodeFrame(): Palette not implemented");
+			break;
 		case EOC:
 			break;
 		default:
 			error("PacoDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
 			break;
 		}
-        _fileStream->seek(currentPos + chunkSize);
+		_fileStream->seek(currentPos + chunkSize);
 	 }
 
 	_curFrame++;
@@ -191,12 +191,12 @@ const Graphics::Surface *PacoDecoder::PacoVideoTrack::decodeNextFrame() {
 
 enum {
 	COPY = 0,		// raw copy pixels
-    RLE, 	 		// RLE
-    PRLE,			// pair RLE (read a pair of pixels and repeat it the specified number of times)
-    QRLE, 			// quad RLE (read four pixels and repeat it the specified number of times)
-    SKIP, 			// skip
-    ENDCURRENTLINE,	// end current line and skip additional len lines
-    EOFRAME = 15 	// not real opcode but 00 F0 00 00 is often seen at the end of frame and can serve as an end marker
+	RLE, 	 		// RLE
+	PRLE,			// pair RLE (read a pair of pixels and repeat it the specified number of times)
+	QRLE, 			// quad RLE (read four pixels and repeat it the specified number of times)
+	SKIP, 			// skip
+	ENDCURRENTLINE,	// end current line and skip additional len lines
+	EOFRAME = 15 	// not real opcode but 00 F0 00 00 is often seen at the end of frame and can serve as an end marker
 };
 
 #define ADJUST_LINE \
@@ -212,16 +212,16 @@ enum {
 	}
 
 #define PUTPIX(pix) \
-    do { \
-        *dst++ = pix; \
-        xpos++; \
-    } while(0);
+	do { \
+		*dst++ = pix; \
+		xpos++; \
+	} while(0);
 
 #define SKIP() \
-    do { \
-        dst++; \
-        xpos++; \
-    } while(0);
+	do { \
+		dst++; \
+		xpos++; \
+	} while(0);
 
 
 void PacoDecoder::PacoVideoTrack::handleFrame(uint32 chunkSize) {
@@ -234,30 +234,30 @@ void PacoDecoder::PacoVideoTrack::handleFrame(uint32 chunkSize) {
 	uint compr = _fileStream->readByte();	    	// compression method and flags
 	_fileStream->readByte();						// padding
 
-    debug("    +%d,%d - %dx%d compr %X", x, y, bw, bh, compr);
+	debug("    +%d,%d - %dx%d compr %X", x, y, bw, bh, compr);
 
-    compr = compr & 0xF;
+	compr = compr & 0xF;
 
-    uint8 *fdata = new uint8[1048576];              // 0x100000 copied from original pacodec
+	uint8 *fdata = new uint8[1048576];              // 0x100000 copied from original pacodec
 	_fileStream->read(fdata, chunkSize - 10);       // remove header length
-    debug("pos: %ld", _fileStream->pos());
+	debug("pos: %ld", _fileStream->pos());
 	int16 xpos = x, ypos = y, ypos2 = y;
-    byte *dst = (byte *)_surface->getPixels() + x + y * w;
+	byte *dst = (byte *)_surface->getPixels() + x + y * w;
 
-    const uint8 *src = fdata;
-    int16 i, c, c1, c2, c3, c4;
-    uint8 clrs[16];
+	const uint8 *src = fdata;
+	int16 i, c, c1, c2, c3, c4;
+	uint8 clrs[16];
 
 
 	while (ypos < y + bh) {
 		c = *src++;
-        debug("debug info: ypos %d y %d bh %d src: %d", ypos, y, bh, c);
+		debug("debug info: ypos %d y %d bh %d src: %d", ypos, y, bh, c);
 
 		if (c == 0 ){ // long operation
 			int16 op = src[0] >> 4;
 			int16 len = ((src[0] & 0xF) << 8) | src[1];
 			src += 2;
-            debug("    long operation: opcode: %d", op);
+			debug("    long operation: opcode: %d", op);
 			switch (op) {
 			case COPY:
 				while (len--)
@@ -278,16 +278,16 @@ void PacoDecoder::PacoVideoTrack::handleFrame(uint32 chunkSize) {
 				break;
 			case QRLE:
 				c1 = *src++;
-                c2 = *src++;
-                c3 = *src++;
-                c4 = *src++;
-                while (len--) {
-                    PUTPIX(c1);
-                    PUTPIX(c2);
-                    PUTPIX(c3);
-                    PUTPIX(c4);
-                }
-                break;
+				c2 = *src++;
+				c3 = *src++;
+				c4 = *src++;
+				while (len--) {
+					PUTPIX(c1);
+					PUTPIX(c2);
+					PUTPIX(c3);
+					PUTPIX(c4);
+				}
+				break;
 			case SKIP:
 				while (len--)
 					SKIP();
@@ -308,183 +308,183 @@ void PacoDecoder::PacoVideoTrack::handleFrame(uint32 chunkSize) {
 			}
 
 		} else if (c < 128) { // copy the same amount of pixels
-            debug("    copy pixels: %d", c);
+			debug("    copy pixels: %d", c);
 			while (c--)
 				PUTPIX(*src++);
 		} else if (c < 254) { // repeat the following value 256 - op times
-            debug("    copy pixels -op: %d", 256 - c);
-            c1 = *src++;
-            c = 256 - c;
-            while (c--)
-                PUTPIX(c1);
-		} else if (c < 255) { 
-			// next byte is either the number of pixels to skip (if non-zero) or 
+			debug("    copy pixels -op: %d", 256 - c);
+			c1 = *src++;
+			c = 256 - c;
+			while (c--)
+				PUTPIX(c1);
+		} else if (c < 255) {
+			// next byte is either the number of pixels to skip (if non-zero) or
 			// a signal of compact RLE mode
 			c = *src++;
 
-            if (!c) {                                   // compact RLE mode
-                unsigned mask = (src[0] << 8) | src[1];
-                src += 2;
-                debug("debug info compact RLE: c: %d mask: %d", c, mask);
-
-                for (i = 0; i < 16; i++, mask >>= 1) {
-                    if (mask & 1)
-                        clrs[i] = *src++;
-                }
-                while (xpos < x + bw) {
-                    int16 op = *src++;
-                    int16 len = op & 0xF;
-                    op >>= 4;
-                    if (op == 0) {                      // low nibble....
-                        op = len;
-                        len = *src++;
-                        debug("debug info compact: op: %d", op);
-                        switch (op) {                 
-                        case COPY:
-                            debug("debug info COPY: %d", len);
-                            while (len--) {
-                                c = *src++;
-                                PUTPIX(clrs[c >> 4]);
-                                if (!len)
-                                    break;
-                                len--;
-                                PUTPIX(clrs[c & 0xF]);
-                            }
-                            break;
-                        case RLE:      
-                            debug("debug info RLE: %d", len);
-                            c = *src++;
-                            while (len--)
-                                PUTPIX(clrs[c & 0xF]);
-                            break;
-                        case PRLE:     
-                            debug("debug info PRLE: %d", len);
-                            c = *src++;
-                            c1 = clrs[c >> 4];
-                            c2 = clrs[c & 0xF];
-                            while (len--) {
-                                PUTPIX(c1);
-                                PUTPIX(c2);
-                            }
-                            break;
-                        case QRLE:          
-                            debug("debug info QRLE: %d", len);
-                            c = *src++;
-                            c1 = clrs[c >> 4];
-                            c2 = clrs[c & 0xF];
-                            c = *src++;
-                            c3 = clrs[c >> 4];
-                            c4 = clrs[c & 0xF];
-                            while (len--) {
-                                PUTPIX(c1);
-                                PUTPIX(c2);
-                                PUTPIX(c3);
-                                PUTPIX(c4);
-                            }
-                            break;
-                        case SKIP:         
-                            debug("debug info SKIP: %d", len);
-                            while (len--)
-                                SKIP();
-                            break;
-                        case ENDCURRENTLINE:
-                            debug("debug info ENDCURRENTLINE: %d", len);
-                            xpos = x + bw;
-                            break;
-                        default:
+			if (!c) {                                   // compact RLE mode
+				unsigned mask = (src[0] << 8) | src[1];
+				src += 2;
+				debug("debug info compact RLE: c: %d mask: %d", c, mask);
+
+				for (i = 0; i < 16; i++, mask >>= 1) {
+					if (mask & 1)
+						clrs[i] = *src++;
+				}
+				while (xpos < x + bw) {
+					int16 op = *src++;
+					int16 len = op & 0xF;
+					op >>= 4;
+					if (op == 0) {                      // low nibble....
+						op = len;
+						len = *src++;
+						debug("debug info compact: op: %d", op);
+						switch (op) {
+						case COPY:
+							debug("debug info COPY: %d", len);
+							while (len--) {
+								c = *src++;
+								PUTPIX(clrs[c >> 4]);
+								if (!len)
+									break;
+								len--;
+								PUTPIX(clrs[c & 0xF]);
+							}
+							break;
+						case RLE:
+							debug("debug info RLE: %d", len);
+							c = *src++;
+							while (len--)
+								PUTPIX(clrs[c & 0xF]);
+							break;
+						case PRLE:
+							debug("debug info PRLE: %d", len);
+							c = *src++;
+							c1 = clrs[c >> 4];
+							c2 = clrs[c & 0xF];
+							while (len--) {
+								PUTPIX(c1);
+								PUTPIX(c2);
+							}
+							break;
+						case QRLE:
+							debug("debug info QRLE: %d", len);
+							c = *src++;
+							c1 = clrs[c >> 4];
+							c2 = clrs[c & 0xF];
+							c = *src++;
+							c3 = clrs[c >> 4];
+							c4 = clrs[c & 0xF];
+							while (len--) {
+								PUTPIX(c1);
+								PUTPIX(c2);
+								PUTPIX(c3);
+								PUTPIX(c4);
+							}
+							break;
+						case SKIP:
+							debug("debug info SKIP: %d", len);
+							while (len--)
+								SKIP();
+							break;
+						case ENDCURRENTLINE:
+							debug("debug info ENDCURRENTLINE: %d", len);
+							xpos = x + bw;
+							break;
+						default:
 							warning("PacoDecoder::PacoVideoTrack::handleFrame: Compact RLE mode: 0x0 op %d", op);
-                        }
-                    } else if (op < 8) {                // copy 1-7 colors
-                        debug("debug info copy 1-7 colors: %d", len);
-                        PUTPIX(clrs[len]);
-                        op--;
-                        while (op--) {
-                            c = *src++;
-                            PUTPIX(clrs[c >> 4]);
-                            if (!op)
-                                break;
-                            op--;
-                            PUTPIX(clrs[c & 0xF]);
-                        }
-                    } else if (op < 14) {              // repeat color
-                        debug("debug info Repeat color: %d", len);
-                        op = 16 - op;
-                        while (op--)
-                            PUTPIX(clrs[len]);  
-                    } else if (op < 15) {               // skip number of pixels in low nibbel
-                        debug("debug info Skip number of pixels: %d", len);
-                        while (len--)
-                            SKIP();
-                    } else {
-                        if (len < 8) {                  // Pair run
-                            debug("debug info pair run: %d", len);
-                            c = *src++;
-                            c1 = clrs[c >> 4];
-                            c2 = clrs[c & 0xF];
-                            while (len--) {
-                                PUTPIX(c1);
-                                PUTPIX(c2);
-                            }
-                        } else {                        // Quad run
-                            debug("debug info quad run: %d", len);
-                            len = 16 - len;
-                            c = *src++;
-                            c1 = clrs[c >> 4];
-                            c2 = clrs[c & 0xF];
-                            c = *src++;
-                            c3 = clrs[c >> 4];
-                            c4 = clrs[c & 0xF];
-                            while (len--) {
-                                PUTPIX(c1);
-                                PUTPIX(c2);
-                                PUTPIX(c3);
-                                PUTPIX(c4);
-                            }
-                        }
-                    }
-                }
-            } else {
-                debug("debug info SKIP: %d", c);
-                while (c--)
-                    SKIP();
-            }
-		} else { 
-			// pair or quad run. Read the next byte and if it is below 128 then read and 
-			// repeat a pair of pixels len times, otherwise read and repeat four pixels 
+						}
+					} else if (op < 8) {                // copy 1-7 colors
+						debug("debug info copy 1-7 colors: %d", len);
+						PUTPIX(clrs[len]);
+						op--;
+						while (op--) {
+							c = *src++;
+							PUTPIX(clrs[c >> 4]);
+							if (!op)
+								break;
+							op--;
+							PUTPIX(clrs[c & 0xF]);
+						}
+					} else if (op < 14) {              // repeat color
+						debug("debug info Repeat color: %d", len);
+						op = 16 - op;
+						while (op--)
+							PUTPIX(clrs[len]);
+					} else if (op < 15) {               // skip number of pixels in low nibbel
+						debug("debug info Skip number of pixels: %d", len);
+						while (len--)
+							SKIP();
+					} else {
+						if (len < 8) {                  // Pair run
+							debug("debug info pair run: %d", len);
+							c = *src++;
+							c1 = clrs[c >> 4];
+							c2 = clrs[c & 0xF];
+							while (len--) {
+								PUTPIX(c1);
+								PUTPIX(c2);
+							}
+						} else {                        // Quad run
+							debug("debug info quad run: %d", len);
+							len = 16 - len;
+							c = *src++;
+							c1 = clrs[c >> 4];
+							c2 = clrs[c & 0xF];
+							c = *src++;
+							c3 = clrs[c >> 4];
+							c4 = clrs[c & 0xF];
+							while (len--) {
+								PUTPIX(c1);
+								PUTPIX(c2);
+								PUTPIX(c3);
+								PUTPIX(c4);
+							}
+						}
+					}
+				}
+			} else {
+				debug("debug info SKIP: %d", c);
+				while (c--)
+					SKIP();
+			}
+		} else {
+			// pair or quad run. Read the next byte and if it is below 128 then read and
+			// repeat a pair of pixels len times, otherwise read and repeat four pixels
 			// (but 256 - len times)
-            c = *src++;
-            if (c < 128) {                             // pair run
-                debug("debug info PAIR RUN: %d", c);
-
-                c1 = *src++;
-                c2 = *src++;
-                while (c--) {
-                    PUTPIX(c1);
-                    PUTPIX(c2);
-                }
-            } else {                                    // quad run
-                debug("debug info QUAD RUN: %d", c);
-                c = 256 - c;
-                c1 = *src++;
-                c2 = *src++;
-                c3 = *src++;
-                c4 = *src++;
-                while (c--) {
-                    PUTPIX(c1);
-                    PUTPIX(c2);
-                    PUTPIX(c3);
-                    PUTPIX(c4);
-                }
-            }
+			c = *src++;
+			if (c < 128) {                             // pair run
+				debug("debug info PAIR RUN: %d", c);
+
+				c1 = *src++;
+				c2 = *src++;
+				while (c--) {
+					PUTPIX(c1);
+					PUTPIX(c2);
+				}
+			} else {                                    // quad run
+				debug("debug info QUAD RUN: %d", c);
+				c = 256 - c;
+				c1 = *src++;
+				c2 = *src++;
+				c3 = *src++;
+				c4 = *src++;
+				while (c--) {
+					PUTPIX(c1);
+					PUTPIX(c2);
+					PUTPIX(c3);
+					PUTPIX(c4);
+				}
+			}
+		}
+		if (xpos > x + bw) debug("!!!");
+		if (xpos >= x + bw) {
+			debug("debug info ADJUST LINE");
+			xpos = x;
+			ypos++;
+			ADJUST_LINE;
+			dst = (byte *)_surface->getPixels() + x + ypos2 * w;
 		}
-        if (xpos > x + bw) debug("!!!");
-        if (xpos >= x + bw) {
-            debug("debug info ADJUST LINE");
-            xpos = x;
-            ypos++;
-            ADJUST_LINE;
-            dst = (byte *)_surface->getPixels() + x + ypos2 * w;
-        }
 	}
 
 	_dirtyRects.clear();
diff --git a/video/paco_decoder.h b/video/paco_decoder.h
index 7ac0b51aa1a..e347168b25f 100644
--- a/video/paco_decoder.h
+++ b/video/paco_decoder.h
@@ -58,8 +58,8 @@ protected:
 	class PacoVideoTrack : public VideoTrack {
 	public:
 		PacoVideoTrack(
-			Common::SeekableReadStream *stream, uint16 frameRate, uint16 frameCount, 
-		    bool hasAudio, uint16 width, uint16 height);
+			Common::SeekableReadStream *stream, uint16 frameRate, uint16 frameCount,
+			bool hasAudio, uint16 width, uint16 height);
 		~PacoVideoTrack();
 
 		bool endOfTrack() const;
@@ -87,7 +87,7 @@ protected:
 		int _curFrame;
 
 		byte *_palette;
-        int _frameSizes[65536]; // can be done differently?
+		int _frameSizes[65536]; // can be done differently?
 		mutable bool _dirtyPalette;
 
 		uint32 _frameCount;




More information about the Scummvm-git-logs mailing list