Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
be6009d3
Commit
be6009d3
authored
Apr 26, 2012
by
Sean McGovern
Committed by
Diego Biurrun
May 06, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests/utils: don't ignore the return value of fwrite()
Signed-off-by:
Diego Biurrun
<
diego@biurrun.de
>
parent
d4ac703c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
utils.c
tests/utils.c
+12
-3
No files found.
tests/utils.c
View file @
be6009d3
...
...
@@ -16,13 +16,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SCALEBITS 8
#define ONE_HALF (1 << (SCALEBITS - 1))
#define FIX(x) ((int) ((x) * (1L << SCALEBITS) + 0.5))
#define err_if(expr) do { \
if (expr) { \
fprintf(stderr, "%s\n", strerror(errno)); \
exit(1); \
} \
} while (0)
static
void
rgb24_to_yuv420p
(
unsigned
char
*
lum
,
unsigned
char
*
cb
,
unsigned
char
*
cr
,
unsigned
char
*
src
,
int
width
,
int
height
)
...
...
@@ -108,14 +117,14 @@ static void pgmyuv_save(const char *filename, int w, int h,
f
=
fopen
(
filename
,
"wb"
);
fprintf
(
f
,
"P5
\n
%d %d
\n
%d
\n
"
,
w
,
h
*
3
/
2
,
255
);
fwrite
(
lum_tab
,
1
,
w
*
h
,
f
);
err_if
(
fwrite
(
lum_tab
,
1
,
w
*
h
,
f
)
!=
w
*
h
);
h2
=
h
/
2
;
w2
=
w
/
2
;
cb
=
cb_tab
;
cr
=
cr_tab
;
for
(
i
=
0
;
i
<
h2
;
i
++
)
{
fwrite
(
cb
,
1
,
w2
,
f
);
fwrite
(
cr
,
1
,
w2
,
f
);
err_if
(
fwrite
(
cb
,
1
,
w2
,
f
)
!=
w2
);
err_if
(
fwrite
(
cr
,
1
,
w2
,
f
)
!=
w2
);
cb
+=
w2
;
cr
+=
w2
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment