Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
6139f481
Commit
6139f481
authored
11 years ago
by
Anton Khirnov
Browse files
Options
Downloads
Patches
Plain Diff
asvenc: use the AVFrame API properly.
parent
13e9cc9c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libavcodec/asv.c
+0
-1
0 additions, 1 deletion
libavcodec/asv.c
libavcodec/asv.h
+0
-1
0 additions, 1 deletion
libavcodec/asv.h
libavcodec/asvenc.c
+18
-15
18 additions, 15 deletions
libavcodec/asvenc.c
with
18 additions
and
17 deletions
libavcodec/asv.c
+
0
−
1
View file @
6139f481
...
@@ -89,6 +89,5 @@ av_cold void ff_asv_common_init(AVCodecContext *avctx) {
...
@@ -89,6 +89,5 @@ av_cold void ff_asv_common_init(AVCodecContext *avctx) {
a
->
mb_width2
=
(
avctx
->
width
+
0
)
/
16
;
a
->
mb_width2
=
(
avctx
->
width
+
0
)
/
16
;
a
->
mb_height2
=
(
avctx
->
height
+
0
)
/
16
;
a
->
mb_height2
=
(
avctx
->
height
+
0
)
/
16
;
avctx
->
coded_frame
=
&
a
->
picture
;
a
->
avctx
=
avctx
;
a
->
avctx
=
avctx
;
}
}
This diff is collapsed.
Click to expand it.
libavcodec/asv.h
+
0
−
1
View file @
6139f481
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
typedef
struct
ASV1Context
{
typedef
struct
ASV1Context
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
DSPContext
dsp
;
DSPContext
dsp
;
AVFrame
picture
;
PutBitContext
pb
;
PutBitContext
pb
;
GetBitContext
gb
;
GetBitContext
gb
;
ScanTable
scantable
;
ScanTable
scantable
;
...
...
This diff is collapsed.
Click to expand it.
libavcodec/asvenc.c
+
18
−
15
View file @
6139f481
...
@@ -147,14 +147,16 @@ static inline int encode_mb(ASV1Context *a, int16_t block[6][64]){
...
@@ -147,14 +147,16 @@ static inline int encode_mb(ASV1Context *a, int16_t block[6][64]){
return
0
;
return
0
;
}
}
static
inline
void
dct_get
(
ASV1Context
*
a
,
int
mb_x
,
int
mb_y
){
static
inline
void
dct_get
(
ASV1Context
*
a
,
const
AVFrame
*
frame
,
int
mb_x
,
int
mb_y
)
{
int16_t
(
*
block
)[
64
]
=
a
->
block
;
int16_t
(
*
block
)[
64
]
=
a
->
block
;
int
linesize
=
a
->
picture
.
linesize
[
0
];
int
linesize
=
frame
->
linesize
[
0
];
int
i
;
int
i
;
uint8_t
*
ptr_y
=
a
->
picture
.
data
[
0
]
+
(
mb_y
*
16
*
linesize
)
+
mb_x
*
16
;
uint8_t
*
ptr_y
=
frame
->
data
[
0
]
+
(
mb_y
*
16
*
linesize
)
+
mb_x
*
16
;
uint8_t
*
ptr_cb
=
a
->
picture
.
data
[
1
]
+
(
mb_y
*
8
*
a
->
picture
.
linesize
[
1
])
+
mb_x
*
8
;
uint8_t
*
ptr_cb
=
frame
->
data
[
1
]
+
(
mb_y
*
8
*
frame
->
linesize
[
1
])
+
mb_x
*
8
;
uint8_t
*
ptr_cr
=
a
->
picture
.
data
[
2
]
+
(
mb_y
*
8
*
a
->
picture
.
linesize
[
2
])
+
mb_x
*
8
;
uint8_t
*
ptr_cr
=
frame
->
data
[
2
]
+
(
mb_y
*
8
*
frame
->
linesize
[
2
])
+
mb_x
*
8
;
a
->
dsp
.
get_pixels
(
block
[
0
],
ptr_y
,
linesize
);
a
->
dsp
.
get_pixels
(
block
[
0
],
ptr_y
,
linesize
);
a
->
dsp
.
get_pixels
(
block
[
1
],
ptr_y
+
8
,
linesize
);
a
->
dsp
.
get_pixels
(
block
[
1
],
ptr_y
+
8
,
linesize
);
...
@@ -164,8 +166,8 @@ static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){
...
@@ -164,8 +166,8 @@ static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){
a
->
dsp
.
fdct
(
block
[
i
]);
a
->
dsp
.
fdct
(
block
[
i
]);
if
(
!
(
a
->
avctx
->
flags
&
CODEC_FLAG_GRAY
)){
if
(
!
(
a
->
avctx
->
flags
&
CODEC_FLAG_GRAY
)){
a
->
dsp
.
get_pixels
(
block
[
4
],
ptr_cb
,
a
->
picture
.
linesize
[
1
]);
a
->
dsp
.
get_pixels
(
block
[
4
],
ptr_cb
,
frame
->
linesize
[
1
]);
a
->
dsp
.
get_pixels
(
block
[
5
],
ptr_cr
,
a
->
picture
.
linesize
[
2
]);
a
->
dsp
.
get_pixels
(
block
[
5
],
ptr_cr
,
frame
->
linesize
[
2
]);
for
(
i
=
4
;
i
<
6
;
i
++
)
for
(
i
=
4
;
i
<
6
;
i
++
)
a
->
dsp
.
fdct
(
block
[
i
]);
a
->
dsp
.
fdct
(
block
[
i
]);
}
}
...
@@ -175,7 +177,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -175,7 +177,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const
AVFrame
*
pict
,
int
*
got_packet
)
const
AVFrame
*
pict
,
int
*
got_packet
)
{
{
ASV1Context
*
const
a
=
avctx
->
priv_data
;
ASV1Context
*
const
a
=
avctx
->
priv_data
;
AVFrame
*
const
p
=
&
a
->
picture
;
int
size
,
ret
;
int
size
,
ret
;
int
mb_x
,
mb_y
;
int
mb_x
,
mb_y
;
...
@@ -188,13 +189,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -188,13 +189,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
init_put_bits
(
&
a
->
pb
,
pkt
->
data
,
pkt
->
size
);
init_put_bits
(
&
a
->
pb
,
pkt
->
data
,
pkt
->
size
);
*
p
=
*
pict
;
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
p
->
key_frame
=
1
;
for
(
mb_y
=
0
;
mb_y
<
a
->
mb_height2
;
mb_y
++
){
for
(
mb_y
=
0
;
mb_y
<
a
->
mb_height2
;
mb_y
++
){
for
(
mb_x
=
0
;
mb_x
<
a
->
mb_width2
;
mb_x
++
){
for
(
mb_x
=
0
;
mb_x
<
a
->
mb_width2
;
mb_x
++
){
dct_get
(
a
,
mb_x
,
mb_y
);
dct_get
(
a
,
pict
,
mb_x
,
mb_y
);
encode_mb
(
a
,
a
->
block
);
encode_mb
(
a
,
a
->
block
);
}
}
}
}
...
@@ -202,7 +199,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -202,7 +199,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
if
(
a
->
mb_width2
!=
a
->
mb_width
){
if
(
a
->
mb_width2
!=
a
->
mb_width
){
mb_x
=
a
->
mb_width2
;
mb_x
=
a
->
mb_width2
;
for
(
mb_y
=
0
;
mb_y
<
a
->
mb_height2
;
mb_y
++
){
for
(
mb_y
=
0
;
mb_y
<
a
->
mb_height2
;
mb_y
++
){
dct_get
(
a
,
mb_x
,
mb_y
);
dct_get
(
a
,
pict
,
mb_x
,
mb_y
);
encode_mb
(
a
,
a
->
block
);
encode_mb
(
a
,
a
->
block
);
}
}
}
}
...
@@ -210,7 +207,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -210,7 +207,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
if
(
a
->
mb_height2
!=
a
->
mb_height
){
if
(
a
->
mb_height2
!=
a
->
mb_height
){
mb_y
=
a
->
mb_height2
;
mb_y
=
a
->
mb_height2
;
for
(
mb_x
=
0
;
mb_x
<
a
->
mb_width
;
mb_x
++
){
for
(
mb_x
=
0
;
mb_x
<
a
->
mb_width
;
mb_x
++
){
dct_get
(
a
,
mb_x
,
mb_y
);
dct_get
(
a
,
pict
,
mb_x
,
mb_y
);
encode_mb
(
a
,
a
->
block
);
encode_mb
(
a
,
a
->
block
);
}
}
}
}
...
@@ -242,6 +239,12 @@ static av_cold int encode_init(AVCodecContext *avctx){
...
@@ -242,6 +239,12 @@ static av_cold int encode_init(AVCodecContext *avctx){
int
i
;
int
i
;
const
int
scale
=
avctx
->
codec_id
==
AV_CODEC_ID_ASV1
?
1
:
2
;
const
int
scale
=
avctx
->
codec_id
==
AV_CODEC_ID_ASV1
?
1
:
2
;
avctx
->
coded_frame
=
av_frame_alloc
();
if
(
!
avctx
->
coded_frame
)
return
AVERROR
(
ENOMEM
);
avctx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
avctx
->
coded_frame
->
key_frame
=
1
;
ff_asv_common_init
(
avctx
);
ff_asv_common_init
(
avctx
);
if
(
avctx
->
global_quality
==
0
)
avctx
->
global_quality
=
4
*
FF_QUALITY_SCALE
;
if
(
avctx
->
global_quality
==
0
)
avctx
->
global_quality
=
4
*
FF_QUALITY_SCALE
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment