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
eeb9e61a
Commit
eeb9e61a
authored
Feb 08, 2012
by
Aneesh Dogra
Committed by
Justin Ruggles
Feb 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v210enc: Use Bytestream2 functions
Signed-off-by:
Justin Ruggles
<
justin.ruggles@gmail.com
>
parent
af701d42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
v210enc.c
libavcodec/v210enc.c
+11
-10
No files found.
libavcodec/v210enc.c
View file @
eeb9e61a
...
...
@@ -55,18 +55,20 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
const
AVFrame
*
pic
=
data
;
int
aligned_width
=
((
avctx
->
width
+
47
)
/
48
)
*
48
;
int
stride
=
aligned_width
*
8
/
3
;
int
line_padding
=
stride
-
((
avctx
->
width
*
8
+
11
)
/
12
)
*
4
;
int
h
,
w
;
const
uint16_t
*
y
=
(
const
uint16_t
*
)
pic
->
data
[
0
];
const
uint16_t
*
u
=
(
const
uint16_t
*
)
pic
->
data
[
1
];
const
uint16_t
*
v
=
(
const
uint16_t
*
)
pic
->
data
[
2
];
uint8_t
*
p
=
buf
;
uint8_t
*
pdst
=
buf
;
PutByteContext
p
;
if
(
buf_size
<
avctx
->
height
*
stride
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"output buffer too small
\n
"
);
return
AVERROR
(
ENOMEM
);
}
bytestream2_init_writer
(
&
p
,
buf
,
buf_size
);
#define CLIP(v) av_clip(v, 4, 1019)
#define WRITE_PIXELS(a, b, c) \
...
...
@@ -74,7 +76,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
val = CLIP(*a++); \
val |= (CLIP(*b++) << 10) | \
(CLIP(*c++) << 20); \
bytestream
_put_le32(&p, val);
\
bytestream
2_put_le32u(&p, val);
\
} while (0)
for
(
h
=
0
;
h
<
avctx
->
height
;
h
++
)
{
...
...
@@ -90,25 +92,24 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
val
=
CLIP
(
*
y
++
);
if
(
w
==
avctx
->
width
-
2
)
bytestream
_put_le32
(
&
p
,
val
);
bytestream
2_put_le32u
(
&
p
,
val
);
}
if
(
w
<
avctx
->
width
-
3
)
{
val
|=
(
CLIP
(
*
u
++
)
<<
10
)
|
(
CLIP
(
*
y
++
)
<<
20
);
bytestream
_put_le32
(
&
p
,
val
);
bytestream
2_put_le32u
(
&
p
,
val
);
val
=
CLIP
(
*
v
++
)
|
(
CLIP
(
*
y
++
)
<<
10
);
bytestream
_put_le32
(
&
p
,
val
);
bytestream
2_put_le32u
(
&
p
,
val
);
}
pdst
+=
stride
;
memset
(
p
,
0
,
pdst
-
p
);
p
=
pdst
;
bytestream2_set_buffer
(
&
p
,
0
,
line_padding
);
y
+=
pic
->
linesize
[
0
]
/
2
-
avctx
->
width
;
u
+=
pic
->
linesize
[
1
]
/
2
-
avctx
->
width
/
2
;
v
+=
pic
->
linesize
[
2
]
/
2
-
avctx
->
width
/
2
;
}
return
p
-
buf
;
return
bytestream2_tell_p
(
&
p
)
;
}
static
av_cold
int
encode_close
(
AVCodecContext
*
avctx
)
...
...
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