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
635bbecf
Commit
635bbecf
authored
May 08, 2011
by
Baptiste Coudurier
Committed by
Anton Khirnov
Sep 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v210enc: clip values according to specifications
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
d239b83e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
v210enc.c
libavcodec/v210enc.c
+8
-6
No files found.
libavcodec/v210enc.c
View file @
635bbecf
...
@@ -66,11 +66,13 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
...
@@ -66,11 +66,13 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
return
-
1
;
return
-
1
;
}
}
#define CLIP(v) av_clip(v, 4, 1019)
#define WRITE_PIXELS(a, b, c) \
#define WRITE_PIXELS(a, b, c) \
do { \
do { \
val =
*a++
; \
val =
CLIP(*a++)
; \
val |= (
*b++
<< 10) | \
val |= (
CLIP(*b++)
<< 10) | \
(
*c++
<< 20); \
(
CLIP(*c++)
<< 20); \
bytestream_put_le32(&p, val); \
bytestream_put_le32(&p, val); \
} while (0)
} while (0)
...
@@ -85,15 +87,15 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
...
@@ -85,15 +87,15 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
if
(
w
<
avctx
->
width
-
1
)
{
if
(
w
<
avctx
->
width
-
1
)
{
WRITE_PIXELS
(
u
,
y
,
v
);
WRITE_PIXELS
(
u
,
y
,
v
);
val
=
*
y
++
;
val
=
CLIP
(
*
y
++
)
;
if
(
w
==
avctx
->
width
-
2
)
if
(
w
==
avctx
->
width
-
2
)
bytestream_put_le32
(
&
p
,
val
);
bytestream_put_le32
(
&
p
,
val
);
}
}
if
(
w
<
avctx
->
width
-
3
)
{
if
(
w
<
avctx
->
width
-
3
)
{
val
|=
(
*
u
++
<<
10
)
|
(
*
y
++
<<
20
);
val
|=
(
CLIP
(
*
u
++
)
<<
10
)
|
(
CLIP
(
*
y
++
)
<<
20
);
bytestream_put_le32
(
&
p
,
val
);
bytestream_put_le32
(
&
p
,
val
);
val
=
*
v
++
|
(
*
y
++
<<
10
);
val
=
CLIP
(
*
v
++
)
|
(
CLIP
(
*
y
++
)
<<
10
);
bytestream_put_le32
(
&
p
,
val
);
bytestream_put_le32
(
&
p
,
val
);
}
}
...
...
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