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
d673972d
Commit
d673972d
authored
Sep 20, 2011
by
Jonne Ahner
Committed by
Michael Niedermayer
Sep 20, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prores: fixes a few prores 4444 samples
parent
989c0282
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
21 deletions
+43
-21
proresdec.c
libavcodec/proresdec.c
+43
-21
No files found.
libavcodec/proresdec.c
View file @
d673972d
...
@@ -141,7 +141,7 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
...
@@ -141,7 +141,7 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
version
=
AV_RB16
(
buf
+
2
);
version
=
AV_RB16
(
buf
+
2
);
av_dlog
(
avctx
,
"%.4s version %d
\n
"
,
buf
+
4
,
version
);
av_dlog
(
avctx
,
"%.4s version %d
\n
"
,
buf
+
4
,
version
);
if
(
version
!=
0
)
{
if
(
version
>
1
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported version: %d
\n
"
,
version
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported version: %d
\n
"
,
version
);
return
-
1
;
return
-
1
;
}
}
...
@@ -168,7 +168,7 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
...
@@ -168,7 +168,7 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
ctx
->
frame
.
top_field_first
=
ctx
->
frame_type
==
1
;
ctx
->
frame
.
top_field_first
=
ctx
->
frame_type
==
1
;
}
}
avctx
->
pix_fmt
=
PIX_FMT_YUV422P10
;
avctx
->
pix_fmt
=
((
buf
[
12
]
&
0xC0
)
==
0xC0
)
?
PIX_FMT_YUV444P10
:
PIX_FMT_YUV422P10
;
ptr
=
buf
+
20
;
ptr
=
buf
+
20
;
flags
=
buf
[
19
];
flags
=
buf
[
19
];
...
@@ -391,10 +391,10 @@ static av_always_inline void decode_ac_coeffs(AVCodecContext *avctx, GetBitConte
...
@@ -391,10 +391,10 @@ static av_always_inline void decode_ac_coeffs(AVCodecContext *avctx, GetBitConte
CLOSE_READER
(
re
,
gb
);
CLOSE_READER
(
re
,
gb
);
}
}
static
void
decode_slice_
luma
(
AVCodecContext
*
avctx
,
SliceContext
*
slice
,
static
void
decode_slice_
full
(
AVCodecContext
*
avctx
,
SliceContext
*
slice
,
uint8_t
*
dst
,
int
dst_stride
,
uint8_t
*
dst
,
int
dst_stride
,
const
uint8_t
*
buf
,
unsigned
buf_size
,
const
uint8_t
*
buf
,
unsigned
buf_size
,
const
int
*
qmat
)
const
int
*
qmat
,
int
rotate
)
{
{
ProresContext
*
ctx
=
avctx
->
priv_data
;
ProresContext
*
ctx
=
avctx
->
priv_data
;
LOCAL_ALIGNED_16
(
DCTELEM
,
blocks
,
[
8
*
4
*
64
]);
LOCAL_ALIGNED_16
(
DCTELEM
,
blocks
,
[
8
*
4
*
64
]);
...
@@ -411,17 +411,30 @@ static void decode_slice_luma(AVCodecContext *avctx, SliceContext *slice,
...
@@ -411,17 +411,30 @@ static void decode_slice_luma(AVCodecContext *avctx, SliceContext *slice,
decode_ac_coeffs
(
avctx
,
&
gb
,
blocks
,
blocks_per_slice
,
qmat
);
decode_ac_coeffs
(
avctx
,
&
gb
,
blocks
,
blocks_per_slice
,
qmat
);
block
=
blocks
;
block
=
blocks
;
for
(
i
=
0
;
i
<
slice
->
mb_count
;
i
++
)
{
ctx
->
idct_put
(
block
+
(
0
<<
6
),
dst
,
dst_stride
);
if
(
rotate
)
{
ctx
->
idct_put
(
block
+
(
1
<<
6
),
dst
+
16
,
dst_stride
);
for
(
i
=
0
;
i
<
slice
->
mb_count
;
i
++
)
{
ctx
->
idct_put
(
block
+
(
2
<<
6
),
dst
+
8
*
dst_stride
,
dst_stride
);
ctx
->
idct_put
(
block
+
(
0
<<
6
),
dst
,
dst_stride
);
ctx
->
idct_put
(
block
+
(
3
<<
6
),
dst
+
8
*
dst_stride
+
16
,
dst_stride
);
ctx
->
idct_put
(
block
+
(
2
<<
6
),
dst
+
16
,
dst_stride
);
block
+=
4
*
64
;
ctx
->
idct_put
(
block
+
(
1
<<
6
),
dst
+
8
*
dst_stride
,
dst_stride
);
dst
+=
32
;
ctx
->
idct_put
(
block
+
(
3
<<
6
),
dst
+
8
*
dst_stride
+
16
,
dst_stride
);
block
+=
4
*
64
;
dst
+=
32
;
}
}
else
{
for
(
i
=
0
;
i
<
slice
->
mb_count
;
i
++
)
{
ctx
->
idct_put
(
block
+
(
0
<<
6
),
dst
,
dst_stride
);
ctx
->
idct_put
(
block
+
(
1
<<
6
),
dst
+
16
,
dst_stride
);
ctx
->
idct_put
(
block
+
(
2
<<
6
),
dst
+
8
*
dst_stride
,
dst_stride
);
ctx
->
idct_put
(
block
+
(
3
<<
6
),
dst
+
8
*
dst_stride
+
16
,
dst_stride
);
block
+=
4
*
64
;
dst
+=
32
;
}
}
}
}
}
static
void
decode_slice_
chroma
(
AVCodecContext
*
avctx
,
SliceContext
*
slice
,
static
void
decode_slice_
half
(
AVCodecContext
*
avctx
,
SliceContext
*
slice
,
uint8_t
*
dst
,
int
dst_stride
,
uint8_t
*
dst
,
int
dst_stride
,
const
uint8_t
*
buf
,
unsigned
buf_size
,
const
uint8_t
*
buf
,
unsigned
buf_size
,
const
int
*
qmat
)
const
int
*
qmat
)
...
@@ -461,6 +474,7 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
...
@@ -461,6 +474,7 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
uint8_t
*
dest_y
,
*
dest_u
,
*
dest_v
;
uint8_t
*
dest_y
,
*
dest_u
,
*
dest_v
;
int
qmat_luma_scaled
[
64
];
int
qmat_luma_scaled
[
64
];
int
qmat_chroma_scaled
[
64
];
int
qmat_chroma_scaled
[
64
];
int
mb_x_shift
;
//av_log(avctx, AV_LOG_INFO, "slice %d mb width %d mb x %d y %d\n",
//av_log(avctx, AV_LOG_INFO, "slice %d mb width %d mb x %d y %d\n",
// jobnr, slice->mb_count, slice->mb_x, slice->mb_y);
// jobnr, slice->mb_count, slice->mb_x, slice->mb_y);
...
@@ -493,9 +507,10 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
...
@@ -493,9 +507,10 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
chroma_stride
=
pic
->
linesize
[
1
]
<<
1
;
chroma_stride
=
pic
->
linesize
[
1
]
<<
1
;
}
}
mb_x_shift
=
(
avctx
->
pix_fmt
==
PIX_FMT_YUV444P10
)
?
5
:
4
;
dest_y
=
pic
->
data
[
0
]
+
(
slice
->
mb_y
<<
4
)
*
luma_stride
+
(
slice
->
mb_x
<<
5
);
dest_y
=
pic
->
data
[
0
]
+
(
slice
->
mb_y
<<
4
)
*
luma_stride
+
(
slice
->
mb_x
<<
5
);
dest_u
=
pic
->
data
[
1
]
+
(
slice
->
mb_y
<<
4
)
*
chroma_stride
+
(
slice
->
mb_x
<<
4
);
dest_u
=
pic
->
data
[
1
]
+
(
slice
->
mb_y
<<
4
)
*
chroma_stride
+
(
slice
->
mb_x
<<
mb_x_shift
);
dest_v
=
pic
->
data
[
2
]
+
(
slice
->
mb_y
<<
4
)
*
chroma_stride
+
(
slice
->
mb_x
<<
4
);
dest_v
=
pic
->
data
[
2
]
+
(
slice
->
mb_y
<<
4
)
*
chroma_stride
+
(
slice
->
mb_x
<<
mb_x_shift
);
if
(
ctx
->
frame_type
&&
ctx
->
first_field
^
ctx
->
frame
.
top_field_first
)
{
if
(
ctx
->
frame_type
&&
ctx
->
first_field
^
ctx
->
frame
.
top_field_first
)
{
dest_y
+=
pic
->
linesize
[
0
];
dest_y
+=
pic
->
linesize
[
0
];
...
@@ -503,14 +518,22 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
...
@@ -503,14 +518,22 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
dest_v
+=
pic
->
linesize
[
2
];
dest_v
+=
pic
->
linesize
[
2
];
}
}
decode_slice_
luma
(
avctx
,
slice
,
dest_y
,
luma_stride
,
decode_slice_
full
(
avctx
,
slice
,
dest_y
,
luma_stride
,
buf
,
y_data_size
,
qmat_luma_scaled
);
buf
,
y_data_size
,
qmat_luma_scaled
,
0
);
if
(
!
(
avctx
->
flags
&
CODEC_FLAG_GRAY
))
{
if
(
avctx
->
flags
&
CODEC_FLAG_GRAY
)
{
decode_slice_chroma
(
avctx
,
slice
,
dest_u
,
chroma_stride
,
}
else
if
(
avctx
->
pix_fmt
==
PIX_FMT_YUV444P10
)
{
decode_slice_full
(
avctx
,
slice
,
dest_u
,
chroma_stride
,
buf
+
y_data_size
,
u_data_size
,
qmat_chroma_scaled
,
1
);
decode_slice_full
(
avctx
,
slice
,
dest_v
,
chroma_stride
,
buf
+
y_data_size
+
u_data_size
,
v_data_size
,
qmat_chroma_scaled
,
1
);
}
else
{
decode_slice_half
(
avctx
,
slice
,
dest_u
,
chroma_stride
,
buf
+
y_data_size
,
u_data_size
,
buf
+
y_data_size
,
u_data_size
,
qmat_chroma_scaled
);
qmat_chroma_scaled
);
decode_slice_
chroma
(
avctx
,
slice
,
dest_v
,
chroma_stride
,
decode_slice_
half
(
avctx
,
slice
,
dest_v
,
chroma_stride
,
buf
+
y_data_size
+
u_data_size
,
v_data_size
,
buf
+
y_data_size
+
u_data_size
,
v_data_size
,
qmat_chroma_scaled
);
qmat_chroma_scaled
);
}
}
...
@@ -541,8 +564,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
...
@@ -541,8 +564,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
int
buf_size
=
avpkt
->
size
;
int
buf_size
=
avpkt
->
size
;
int
frame_hdr_size
,
pic_size
;
int
frame_hdr_size
,
pic_size
;
if
(
buf_size
<
28
||
buf_size
!=
AV_RB32
(
buf
)
||
if
(
buf_size
<
28
||
AV_RL32
(
buf
+
4
)
!=
AV_RL32
(
"icpf"
))
{
AV_RL32
(
buf
+
4
)
!=
AV_RL32
(
"icpf"
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid frame header
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid frame header
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
...
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