Skip to content

Commit 9af8e61

Browse files
committed
WIP recorded AVI playback
1 parent 4fa2ae9 commit 9af8e61

File tree

13 files changed

+232
-119
lines changed

13 files changed

+232
-119
lines changed

MLDX12VideoCapture/MLAviReader.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,12 @@ MLAviReader::GetImage(const int frameNr, const uint32_t buffBytes, uint8_t *buff
320320
}
321321

322322
ImagePosBytes pb = mImages[frameNr];
323+
if (pb.bytes < buffBytes) {
324+
printf("Error: buffBytes is too small\n");
325+
return E_FAIL;
326+
}
323327

324328
_fseeki64(mFp, pb.pos, SEEK_SET);
325-
uint32_t copyBytes = buffBytes;
326-
if (pb.bytes < copyBytes) {
327-
copyBytes = pb.bytes;
328-
}
329329

330-
return (int)fread(buff, 1, copyBytes, mFp);
330+
return (int)fread(buff, 1, buffBytes, mFp);
331331
}

MLDX12VideoCapture/MLCapturedImage.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

MLDX12VideoCapture/MLConverter.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ MLConverter::CreateGammaTable(const float gamma, const float gainR, const float
5757
}
5858

5959
void
60-
MLConverter::Rgb10bitToRGBA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height)
60+
MLConverter::Rgb10bitToRGBA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height, const uint8_t alpha)
6161
{
62-
const uint32_t a = 0xff;
62+
const uint32_t a = alpha;
6363
int pos = 0;
6464
for (int y = 0; y < height; ++y) {
6565
for (int x = 0; x < width; ++x) {
@@ -75,9 +75,9 @@ MLConverter::Rgb10bitToRGBA(uint32_t *pFrom, uint32_t *pTo, const int width, con
7575
}
7676

7777
void
78-
MLConverter::YuvV210ToYuvA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height)
78+
MLConverter::YuvV210ToYuvA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height, const uint8_t alpha)
7979
{
80-
const uint8_t a = 0xff;
80+
const uint8_t a = alpha;
8181
for (int y = 0; y < height; ++y) {
8282
for (int x = 0; x < width / 6; ++x) {
8383
const int posF = 4 * (x + y * width / 6);
@@ -118,7 +118,7 @@ MLConverter::YuvV210ToYuvA(uint32_t *pFrom, uint32_t *pTo, const int width, cons
118118
}
119119

120120
void
121-
MLConverter::RawYuvV210ToRGBA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height)
121+
MLConverter::RawYuvV210ToRGBA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height, const uint8_t alpha)
122122
{
123123
assert(width == 3840);
124124
assert(height == 2160);
@@ -204,7 +204,7 @@ MLConverter::RawYuvV210ToRGBA(uint32_t *pFrom, uint32_t *pTo, const int width, c
204204
}
205205
}
206206

207-
const uint8_t a = 0xff;
207+
const uint8_t a = alpha;
208208
for (y = 0; y < height; y += 2) {
209209
for (x = 0; x < width; x += 2) {
210210
/* G0 R

MLDX12VideoCapture/MLConverter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ class MLConverter {
88
~MLConverter(void);
99

1010
void CreateGammaTable(const float gamma, const float gainR, const float gainG, const float gainB);
11-
void RawYuvV210ToRGBA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height);
11+
void RawYuvV210ToRGBA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height, const uint8_t alpha);
1212

13-
static void YuvV210ToYuvA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height);
14-
static void Rgb10bitToRGBA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height);
13+
static void YuvV210ToYuvA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height, const uint8_t alpha);
14+
static void Rgb10bitToRGBA(uint32_t *pFrom, uint32_t *pTo, const int width, const int height, const uint8_t alpha);
1515
private:
1616
// 12bit value to 8bit value
1717
uint8_t mGammaTableR[4096];

0 commit comments

Comments
 (0)