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
57e7b3a8
Commit
57e7b3a8
authored
Nov 09, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnxhdenc: use the AVFrame API properly.
parent
d2287740
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
+14
-15
dnxhdenc.c
libavcodec/dnxhdenc.c
+14
-14
dnxhdenc.h
libavcodec/dnxhdenc.h
+0
-1
No files found.
libavcodec/dnxhdenc.c
View file @
57e7b3a8
...
@@ -307,9 +307,12 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
...
@@ -307,9 +307,12 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
FF_ALLOCZ_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
mb_bits
,
ctx
->
m
.
mb_num
*
sizeof
(
uint16_t
),
fail
);
FF_ALLOCZ_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
mb_bits
,
ctx
->
m
.
mb_num
*
sizeof
(
uint16_t
),
fail
);
FF_ALLOCZ_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
mb_qscale
,
ctx
->
m
.
mb_num
*
sizeof
(
uint8_t
),
fail
);
FF_ALLOCZ_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
mb_qscale
,
ctx
->
m
.
mb_num
*
sizeof
(
uint8_t
),
fail
);
ctx
->
frame
.
key_frame
=
1
;
avctx
->
coded_frame
=
av_frame_alloc
();
ctx
->
frame
.
pict_type
=
AV_PICTURE_TYPE_I
;
if
(
!
avctx
->
coded_frame
)
ctx
->
m
.
avctx
->
coded_frame
=
&
ctx
->
frame
;
return
AVERROR
(
ENOMEM
);
avctx
->
coded_frame
->
key_frame
=
1
;
avctx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
if
(
avctx
->
thread_count
>
MAX_THREADS
)
{
if
(
avctx
->
thread_count
>
MAX_THREADS
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"too many threads
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"too many threads
\n
"
);
...
@@ -908,19 +911,14 @@ static void dnxhd_load_picture(DNXHDEncContext *ctx, const AVFrame *frame)
...
@@ -908,19 +911,14 @@ static void dnxhd_load_picture(DNXHDEncContext *ctx, const AVFrame *frame)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
ctx
->
frame
.
data
[
i
]
=
frame
->
data
[
i
];
ctx
->
frame
.
linesize
[
i
]
=
frame
->
linesize
[
i
];
}
for
(
i
=
0
;
i
<
ctx
->
m
.
avctx
->
thread_count
;
i
++
)
{
for
(
i
=
0
;
i
<
ctx
->
m
.
avctx
->
thread_count
;
i
++
)
{
ctx
->
thread
[
i
]
->
m
.
linesize
=
ctx
->
frame
.
linesize
[
0
]
<<
ctx
->
interlaced
;
ctx
->
thread
[
i
]
->
m
.
linesize
=
frame
->
linesize
[
0
]
<<
ctx
->
interlaced
;
ctx
->
thread
[
i
]
->
m
.
uvlinesize
=
ctx
->
frame
.
linesize
[
1
]
<<
ctx
->
interlaced
;
ctx
->
thread
[
i
]
->
m
.
uvlinesize
=
frame
->
linesize
[
1
]
<<
ctx
->
interlaced
;
ctx
->
thread
[
i
]
->
dct_y_offset
=
ctx
->
m
.
linesize
*
8
;
ctx
->
thread
[
i
]
->
dct_y_offset
=
ctx
->
m
.
linesize
*
8
;
ctx
->
thread
[
i
]
->
dct_uv_offset
=
ctx
->
m
.
uvlinesize
*
8
;
ctx
->
thread
[
i
]
->
dct_uv_offset
=
ctx
->
m
.
uvlinesize
*
8
;
}
}
ctx
->
frame
.
interlaced_frame
=
frame
->
interlaced_frame
;
ctx
->
m
.
avctx
->
coded_frame
->
interlaced_frame
=
frame
->
interlaced_frame
;
ctx
->
cur_field
=
frame
->
interlaced_frame
&&
!
frame
->
top_field_first
;
ctx
->
cur_field
=
frame
->
interlaced_frame
&&
!
frame
->
top_field_first
;
}
}
...
@@ -942,9 +940,9 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -942,9 +940,9 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
encode_coding_unit:
encode_coding_unit:
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
ctx
->
src
[
i
]
=
ctx
->
frame
.
data
[
i
];
ctx
->
src
[
i
]
=
frame
->
data
[
i
];
if
(
ctx
->
interlaced
&&
ctx
->
cur_field
)
if
(
ctx
->
interlaced
&&
ctx
->
cur_field
)
ctx
->
src
[
i
]
+=
ctx
->
frame
.
linesize
[
i
];
ctx
->
src
[
i
]
+=
frame
->
linesize
[
i
];
}
}
dnxhd_write_header
(
avctx
,
buf
);
dnxhd_write_header
(
avctx
,
buf
);
...
@@ -982,7 +980,7 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -982,7 +980,7 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
goto
encode_coding_unit
;
goto
encode_coding_unit
;
}
}
ctx
->
frame
.
quality
=
ctx
->
qscale
*
FF_QP2LAMBDA
;
avctx
->
coded_frame
->
quality
=
ctx
->
qscale
*
FF_QP2LAMBDA
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
*
got_packet
=
1
;
*
got_packet
=
1
;
...
@@ -1015,6 +1013,8 @@ static av_cold int dnxhd_encode_end(AVCodecContext *avctx)
...
@@ -1015,6 +1013,8 @@ static av_cold int dnxhd_encode_end(AVCodecContext *avctx)
for
(
i
=
1
;
i
<
avctx
->
thread_count
;
i
++
)
for
(
i
=
1
;
i
<
avctx
->
thread_count
;
i
++
)
av_freep
(
&
ctx
->
thread
[
i
]);
av_freep
(
&
ctx
->
thread
[
i
]);
av_frame_free
(
&
avctx
->
coded_frame
);
return
0
;
return
0
;
}
}
...
...
libavcodec/dnxhdenc.h
View file @
57e7b3a8
...
@@ -43,7 +43,6 @@ typedef struct DNXHDEncContext {
...
@@ -43,7 +43,6 @@ typedef struct DNXHDEncContext {
AVClass
*
class
;
AVClass
*
class
;
MpegEncContext
m
;
///< Used for quantization dsp functions
MpegEncContext
m
;
///< Used for quantization dsp functions
AVFrame
frame
;
int
cid
;
int
cid
;
const
CIDEntry
*
cid_table
;
const
CIDEntry
*
cid_table
;
uint8_t
*
msip
;
///< Macroblock Scan Indexes Payload
uint8_t
*
msip
;
///< Macroblock Scan Indexes Payload
...
...
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