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
1848a154
Commit
1848a154
authored
9 years ago
by
Anton Khirnov
Browse files
Options
Downloads
Patches
Plain Diff
svq3: stop using H264Context.gb
parent
ea6ab02a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/svq3.c
+31
-30
31 additions, 30 deletions
libavcodec/svq3.c
with
31 additions
and
30 deletions
libavcodec/svq3.c
+
31
−
30
View file @
1848a154
...
...
@@ -79,6 +79,7 @@ typedef struct SVQ3Context {
H264Picture
*
next_pic
;
H264Picture
*
last_pic
;
GetBitContext
gb
;
GetBitContext
gb_slice
;
uint8_t
*
slice_buf
;
int
slice_size
;
int
halfpel_flag
;
...
...
@@ -527,8 +528,8 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
if
(
mode
==
PREDICT_MODE
)
{
dx
=
dy
=
0
;
}
else
{
dy
=
svq3_get_se_golomb
(
&
h
->
gb
);
dx
=
svq3_get_se_golomb
(
&
h
->
gb
);
dy
=
svq3_get_se_golomb
(
&
s
->
gb
_slice
);
dx
=
svq3_get_se_golomb
(
&
s
->
gb
_slice
);
if
(
dx
==
INVALID_VLC
||
dy
==
INVALID_VLC
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"invalid MV vlc
\n
"
);
...
...
@@ -736,10 +737,10 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
mb_type
=
MB_TYPE_16x16
;
}
}
else
if
(
mb_type
<
8
)
{
/* INTER */
if
(
s
->
thirdpel_flag
&&
s
->
halfpel_flag
==
!
get_bits1
(
&
h
->
gb
))
if
(
s
->
thirdpel_flag
&&
s
->
halfpel_flag
==
!
get_bits1
(
&
s
->
gb
_slice
))
mode
=
THIRDPEL_MODE
;
else
if
(
s
->
halfpel_flag
&&
s
->
thirdpel_flag
==
!
get_bits1
(
&
h
->
gb
))
s
->
thirdpel_flag
==
!
get_bits1
(
&
s
->
gb
_slice
))
mode
=
HALFPEL_MODE
;
else
mode
=
FULLPEL_MODE
;
...
...
@@ -841,7 +842,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
/* decode prediction codes for luma blocks */
for
(
i
=
0
;
i
<
16
;
i
+=
2
)
{
vlc
=
svq3_get_ue_golomb
(
&
h
->
gb
);
vlc
=
svq3_get_ue_golomb
(
&
s
->
gb
_slice
);
if
(
vlc
>=
25
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
...
...
@@ -919,7 +920,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
if
(
!
IS_INTRA16x16
(
mb_type
)
&&
(
!
IS_SKIP
(
mb_type
)
||
s
->
pict_type
==
AV_PICTURE_TYPE_B
))
{
if
((
vlc
=
svq3_get_ue_golomb
(
&
h
->
gb
))
>=
48
)
{
if
((
vlc
=
svq3_get_ue_golomb
(
&
s
->
gb
_slice
))
>=
48
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"cbp_vlc=%"
PRIu32
"
\n
"
,
vlc
);
return
-
1
;
}
...
...
@@ -929,7 +930,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
}
if
(
IS_INTRA16x16
(
mb_type
)
||
(
s
->
pict_type
!=
AV_PICTURE_TYPE_I
&&
s
->
adaptive_quant
&&
cbp
))
{
s
->
qscale
+=
svq3_get_se_golomb
(
&
h
->
gb
);
s
->
qscale
+=
svq3_get_se_golomb
(
&
s
->
gb
_slice
);
if
(
s
->
qscale
>
31u
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"qscale:%d
\n
"
,
s
->
qscale
);
...
...
@@ -939,7 +940,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
if
(
IS_INTRA16x16
(
mb_type
))
{
AV_ZERO128
(
s
->
mb_luma_dc
[
0
]
+
0
);
AV_ZERO128
(
s
->
mb_luma_dc
[
0
]
+
8
);
if
(
svq3_decode_block
(
&
h
->
gb
,
s
->
mb_luma_dc
[
0
],
0
,
1
))
{
if
(
svq3_decode_block
(
&
s
->
gb
_slice
,
s
->
mb_luma_dc
[
0
],
0
,
1
))
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"error while decoding intra luma dc
\n
"
);
return
-
1
;
...
...
@@ -958,7 +959,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
:
(
4
*
i
+
j
);
s
->
non_zero_count_cache
[
scan8
[
k
]]
=
1
;
if
(
svq3_decode_block
(
&
h
->
gb
,
&
s
->
mb
[
16
*
k
],
index
,
type
))
{
if
(
svq3_decode_block
(
&
s
->
gb
_slice
,
&
s
->
mb
[
16
*
k
],
index
,
type
))
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"error while decoding block
\n
"
);
return
-
1
;
...
...
@@ -968,7 +969,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
if
((
cbp
&
0x30
))
{
for
(
i
=
1
;
i
<
3
;
++
i
)
if
(
svq3_decode_block
(
&
h
->
gb
,
&
s
->
mb
[
16
*
16
*
i
],
0
,
3
))
{
if
(
svq3_decode_block
(
&
s
->
gb
_slice
,
&
s
->
mb
[
16
*
16
*
i
],
0
,
3
))
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"error while decoding chroma dc block
\n
"
);
return
-
1
;
...
...
@@ -980,7 +981,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
k
=
16
*
i
+
j
;
s
->
non_zero_count_cache
[
scan8
[
k
]]
=
1
;
if
(
svq3_decode_block
(
&
h
->
gb
,
&
s
->
mb
[
16
*
k
],
1
,
1
))
{
if
(
svq3_decode_block
(
&
s
->
gb
_slice
,
&
s
->
mb
[
16
*
k
],
1
,
1
))
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"error while decoding chroma ac block
\n
"
);
return
-
1
;
...
...
@@ -1036,11 +1037,11 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
memcpy
(
s
->
slice_buf
,
s
->
gb
.
buffer
+
s
->
gb
.
index
/
8
,
slice_bytes
);
init_get_bits
(
&
h
->
gb
,
s
->
slice_buf
,
slice_bits
);
init_get_bits
(
&
s
->
gb
_slice
,
s
->
slice_buf
,
slice_bits
);
if
(
s
->
watermark_key
)
{
uint32_t
header
=
AV_RL32
(
&
h
->
gb
.
buffer
[
1
]);
AV_WL32
(
&
h
->
gb
.
buffer
[
1
],
header
^
s
->
watermark_key
);
uint32_t
header
=
AV_RL32
(
&
s
->
gb
_slice
.
buffer
[
1
]);
AV_WL32
(
&
s
->
gb
_slice
.
buffer
[
1
],
header
^
s
->
watermark_key
);
}
if
(
length
>
0
)
{
memcpy
(
s
->
slice_buf
,
&
s
->
slice_buf
[
slice_length
],
length
-
1
);
...
...
@@ -1048,7 +1049,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
skip_bits_long
(
&
s
->
gb
,
slice_bytes
*
8
);
}
if
((
slice_id
=
svq3_get_ue_golomb
(
&
h
->
gb
))
>=
3
)
{
if
((
slice_id
=
svq3_get_ue_golomb
(
&
s
->
gb
_slice
))
>=
3
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"illegal slice type %u
\n
"
,
slice_id
);
return
-
1
;
}
...
...
@@ -1057,26 +1058,26 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
if
((
header
&
0x9F
)
==
2
)
{
i
=
(
s
->
mb_num
<
64
)
?
6
:
(
1
+
av_log2
(
s
->
mb_num
-
1
));
get_bits
(
&
h
->
gb
,
i
);
get_bits
(
&
s
->
gb
_slice
,
i
);
}
else
{
skip_bits1
(
&
h
->
gb
);
skip_bits1
(
&
s
->
gb
_slice
);
}
s
->
slice_num
=
get_bits
(
&
h
->
gb
,
8
);
s
->
qscale
=
get_bits
(
&
h
->
gb
,
5
);
s
->
adaptive_quant
=
get_bits1
(
&
h
->
gb
);
s
->
slice_num
=
get_bits
(
&
s
->
gb
_slice
,
8
);
s
->
qscale
=
get_bits
(
&
s
->
gb
_slice
,
5
);
s
->
adaptive_quant
=
get_bits1
(
&
s
->
gb
_slice
);
/* unknown fields */
skip_bits1
(
&
h
->
gb
);
skip_bits1
(
&
s
->
gb
_slice
);
if
(
s
->
unknown_flag
)
skip_bits1
(
&
h
->
gb
);
skip_bits1
(
&
s
->
gb
_slice
);
skip_bits1
(
&
h
->
gb
);
skip_bits
(
&
h
->
gb
,
2
);
skip_bits1
(
&
s
->
gb
_slice
);
skip_bits
(
&
s
->
gb
_slice
,
2
);
while
(
get_bits1
(
&
h
->
gb
))
skip_bits
(
&
h
->
gb
,
8
);
while
(
get_bits1
(
&
s
->
gb
_slice
))
skip_bits
(
&
s
->
gb
_slice
,
8
);
/* reset intra predictors and invalidate motion vector references */
if
(
s
->
mb_x
>
0
)
{
...
...
@@ -1508,9 +1509,9 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
unsigned
mb_type
;
s
->
mb_xy
=
s
->
mb_x
+
s
->
mb_y
*
s
->
mb_stride
;
if
((
get_bits_left
(
&
h
->
gb
))
<=
7
)
{
if
(((
get_bits_count
(
&
h
->
gb
)
&
7
)
==
0
||
show_bits
(
&
h
->
gb
,
get_bits_left
(
&
h
->
gb
)
&
7
)
==
0
))
{
if
((
get_bits_left
(
&
s
->
gb
_slice
))
<=
7
)
{
if
(((
get_bits_count
(
&
s
->
gb
_slice
)
&
7
)
==
0
||
show_bits
(
&
s
->
gb
_slice
,
get_bits_left
(
&
s
->
gb
_slice
)
&
7
)
==
0
))
{
if
(
svq3_decode_slice_header
(
avctx
))
return
-
1
;
...
...
@@ -1518,7 +1519,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
/* TODO: support s->mb_skip_run */
}
mb_type
=
svq3_get_ue_golomb
(
&
h
->
gb
);
mb_type
=
svq3_get_ue_golomb
(
&
s
->
gb
_slice
);
if
(
s
->
pict_type
==
AV_PICTURE_TYPE_I
)
mb_type
+=
8
;
...
...
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