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
3c0ed7d1
Commit
3c0ed7d1
authored
Feb 22, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asv1enc: switch to encode2().
parent
df53a473
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
10 deletions
+24
-10
asv1.c
libavcodec/asv1.c
+24
-10
No files found.
libavcodec/asv1.c
View file @
3c0ed7d1
...
@@ -325,10 +325,12 @@ static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){
...
@@ -325,10 +325,12 @@ static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){
return
0
;
return
0
;
}
}
#define MAX_MB_SIZE (30*16*16*3/2/8)
static
inline
int
encode_mb
(
ASV1Context
*
a
,
DCTELEM
block
[
6
][
64
]){
static
inline
int
encode_mb
(
ASV1Context
*
a
,
DCTELEM
block
[
6
][
64
]){
int
i
;
int
i
;
if
(
a
->
pb
.
buf_end
-
a
->
pb
.
buf
-
(
put_bits_count
(
&
a
->
pb
)
>>
3
)
<
30
*
16
*
16
*
3
/
2
/
8
)
{
if
(
a
->
pb
.
buf_end
-
a
->
pb
.
buf
-
(
put_bits_count
(
&
a
->
pb
)
>>
3
)
<
MAX_MB_SIZE
)
{
av_log
(
a
->
avctx
,
AV_LOG_ERROR
,
"encoded frame too large
\n
"
);
av_log
(
a
->
avctx
,
AV_LOG_ERROR
,
"encoded frame too large
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -461,14 +463,22 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -461,14 +463,22 @@ static int decode_frame(AVCodecContext *avctx,
}
}
#if CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER
#if CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER
static
int
encode_frame
(
AVCodecContext
*
avctx
,
unsigned
char
*
buf
,
int
buf_size
,
void
*
data
){
static
int
encode_frame
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
pict
,
int
*
got_packet
)
{
ASV1Context
*
const
a
=
avctx
->
priv_data
;
ASV1Context
*
const
a
=
avctx
->
priv_data
;
AVFrame
*
pict
=
data
;
AVFrame
*
const
p
=
&
a
->
picture
;
AVFrame
*
const
p
=
&
a
->
picture
;
int
size
;
int
size
,
ret
;
int
mb_x
,
mb_y
;
int
mb_x
,
mb_y
;
init_put_bits
(
&
a
->
pb
,
buf
,
buf_size
);
if
(
!
pkt
->
data
&&
(
ret
=
av_new_packet
(
pkt
,
a
->
mb_height
*
a
->
mb_width
*
MAX_MB_SIZE
+
FF_MIN_BUFFER_SIZE
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error getting output packet.
\n
"
);
return
ret
;
}
init_put_bits
(
&
a
->
pb
,
pkt
->
data
,
pkt
->
size
);
*
p
=
*
pict
;
*
p
=
*
pict
;
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
...
@@ -505,14 +515,18 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
...
@@ -505,14 +515,18 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
size
=
put_bits_count
(
&
a
->
pb
)
/
32
;
size
=
put_bits_count
(
&
a
->
pb
)
/
32
;
if
(
avctx
->
codec_id
==
CODEC_ID_ASV1
)
if
(
avctx
->
codec_id
==
CODEC_ID_ASV1
)
a
->
dsp
.
bswap_buf
((
uint32_t
*
)
buf
,
(
uint32_t
*
)
buf
,
size
);
a
->
dsp
.
bswap_buf
((
uint32_t
*
)
pkt
->
data
,
(
uint32_t
*
)
pkt
->
data
,
size
);
else
{
else
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
4
*
size
;
i
++
)
for
(
i
=
0
;
i
<
4
*
size
;
i
++
)
buf
[
i
]
=
av_reverse
[
buf
[
i
]
];
pkt
->
data
[
i
]
=
av_reverse
[
pkt
->
data
[
i
]
];
}
}
return
size
*
4
;
pkt
->
size
=
size
*
4
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
*
got_packet
=
1
;
return
0
;
}
}
#endif
/* CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER */
#endif
/* CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER */
...
@@ -634,7 +648,7 @@ AVCodec ff_asv1_encoder = {
...
@@ -634,7 +648,7 @@ AVCodec ff_asv1_encoder = {
.
id
=
CODEC_ID_ASV1
,
.
id
=
CODEC_ID_ASV1
,
.
priv_data_size
=
sizeof
(
ASV1Context
),
.
priv_data_size
=
sizeof
(
ASV1Context
),
.
init
=
encode_init
,
.
init
=
encode_init
,
.
encode
=
encode_frame
,
.
encode
2
=
encode_frame
,
//encode_end,
//encode_end,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"ASUS V1"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"ASUS V1"
),
...
@@ -648,7 +662,7 @@ AVCodec ff_asv2_encoder = {
...
@@ -648,7 +662,7 @@ AVCodec ff_asv2_encoder = {
.
id
=
CODEC_ID_ASV2
,
.
id
=
CODEC_ID_ASV2
,
.
priv_data_size
=
sizeof
(
ASV1Context
),
.
priv_data_size
=
sizeof
(
ASV1Context
),
.
init
=
encode_init
,
.
init
=
encode_init
,
.
encode
=
encode_frame
,
.
encode
2
=
encode_frame
,
//encode_end,
//encode_end,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"ASUS V2"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"ASUS V2"
),
...
...
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