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
300ef253
Commit
300ef253
authored
Apr 30, 2018
by
Mark Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cbs: Add support for array subscripts in trace output
This makes the trace output for arrays significantly nicer.
parent
315cc8c0
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
261 additions
and
206 deletions
+261
-206
cbs.c
libavcodec/cbs.c
+37
-7
cbs_h2645.c
libavcodec/cbs_h2645.c
+48
-35
cbs_h264_syntax_template.c
libavcodec/cbs_h264_syntax_template.c
+50
-51
cbs_h265_syntax_template.c
libavcodec/cbs_h265_syntax_template.c
+94
-85
cbs_internal.h
libavcodec/cbs_internal.h
+6
-4
cbs_mpeg2.c
libavcodec/cbs_mpeg2.c
+13
-12
cbs_mpeg2_syntax_template.c
libavcodec/cbs_mpeg2_syntax_template.c
+13
-12
No files found.
libavcodec/cbs.c
View file @
300ef253
...
@@ -356,17 +356,43 @@ void ff_cbs_trace_header(CodedBitstreamContext *ctx,
...
@@ -356,17 +356,43 @@ void ff_cbs_trace_header(CodedBitstreamContext *ctx,
}
}
void
ff_cbs_trace_syntax_element
(
CodedBitstreamContext
*
ctx
,
int
position
,
void
ff_cbs_trace_syntax_element
(
CodedBitstreamContext
*
ctx
,
int
position
,
const
char
*
name
,
const
char
*
bi
ts
,
const
char
*
str
,
const
int
*
subscrip
ts
,
int64_t
value
)
const
char
*
bits
,
int64_t
value
)
{
{
char
name
[
256
];
size_t
name_len
,
bits_len
;
size_t
name_len
,
bits_len
;
int
pad
;
int
pad
,
subs
,
i
,
j
,
k
,
n
;
if
(
!
ctx
->
trace_enable
)
if
(
!
ctx
->
trace_enable
)
return
;
return
;
av_assert0
(
value
>=
INT_MIN
&&
value
<=
UINT32_MAX
);
av_assert0
(
value
>=
INT_MIN
&&
value
<=
UINT32_MAX
);
subs
=
subscripts
?
subscripts
[
0
]
:
0
;
n
=
0
;
for
(
i
=
j
=
0
;
str
[
i
];)
{
if
(
str
[
i
]
==
'['
)
{
if
(
n
<
subs
)
{
++
n
;
k
=
snprintf
(
name
+
j
,
sizeof
(
name
)
-
j
,
"[%d"
,
subscripts
[
n
]);
av_assert0
(
k
>
0
&&
j
+
k
<
sizeof
(
name
));
j
+=
k
;
for
(
++
i
;
str
[
i
]
&&
str
[
i
]
!=
']'
;
i
++
);
av_assert0
(
str
[
i
]
==
']'
);
}
else
{
while
(
str
[
i
]
&&
str
[
i
]
!=
']'
)
name
[
j
++
]
=
str
[
i
++
];
av_assert0
(
str
[
i
]
==
']'
);
}
}
else
{
av_assert0
(
j
+
1
<
sizeof
(
name
));
name
[
j
++
]
=
str
[
i
++
];
}
}
av_assert0
(
j
+
1
<
sizeof
(
name
));
name
[
j
]
=
0
;
av_assert0
(
n
==
subs
);
name_len
=
strlen
(
name
);
name_len
=
strlen
(
name
);
bits_len
=
strlen
(
bits
);
bits_len
=
strlen
(
bits
);
...
@@ -380,7 +406,8 @@ void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position,
...
@@ -380,7 +406,8 @@ void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position,
}
}
int
ff_cbs_read_unsigned
(
CodedBitstreamContext
*
ctx
,
GetBitContext
*
gbc
,
int
ff_cbs_read_unsigned
(
CodedBitstreamContext
*
ctx
,
GetBitContext
*
gbc
,
int
width
,
const
char
*
name
,
uint32_t
*
write_to
,
int
width
,
const
char
*
name
,
const
int
*
subscripts
,
uint32_t
*
write_to
,
uint32_t
range_min
,
uint32_t
range_max
)
uint32_t
range_min
,
uint32_t
range_max
)
{
{
uint32_t
value
;
uint32_t
value
;
...
@@ -406,7 +433,8 @@ int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc,
...
@@ -406,7 +433,8 @@ int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc,
bits
[
i
]
=
value
>>
(
width
-
i
-
1
)
&
1
?
'1'
:
'0'
;
bits
[
i
]
=
value
>>
(
width
-
i
-
1
)
&
1
?
'1'
:
'0'
;
bits
[
i
]
=
0
;
bits
[
i
]
=
0
;
ff_cbs_trace_syntax_element
(
ctx
,
position
,
name
,
bits
,
value
);
ff_cbs_trace_syntax_element
(
ctx
,
position
,
name
,
subscripts
,
bits
,
value
);
}
}
if
(
value
<
range_min
||
value
>
range_max
)
{
if
(
value
<
range_min
||
value
>
range_max
)
{
...
@@ -421,7 +449,8 @@ int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc,
...
@@ -421,7 +449,8 @@ int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc,
}
}
int
ff_cbs_write_unsigned
(
CodedBitstreamContext
*
ctx
,
PutBitContext
*
pbc
,
int
ff_cbs_write_unsigned
(
CodedBitstreamContext
*
ctx
,
PutBitContext
*
pbc
,
int
width
,
const
char
*
name
,
uint32_t
value
,
int
width
,
const
char
*
name
,
const
int
*
subscripts
,
uint32_t
value
,
uint32_t
range_min
,
uint32_t
range_max
)
uint32_t
range_min
,
uint32_t
range_max
)
{
{
av_assert0
(
width
>
0
&&
width
<=
32
);
av_assert0
(
width
>
0
&&
width
<=
32
);
...
@@ -443,7 +472,8 @@ int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc,
...
@@ -443,7 +472,8 @@ int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc,
bits
[
i
]
=
value
>>
(
width
-
i
-
1
)
&
1
?
'1'
:
'0'
;
bits
[
i
]
=
value
>>
(
width
-
i
-
1
)
&
1
?
'1'
:
'0'
;
bits
[
i
]
=
0
;
bits
[
i
]
=
0
;
ff_cbs_trace_syntax_element
(
ctx
,
put_bits_count
(
pbc
),
name
,
bits
,
value
);
ff_cbs_trace_syntax_element
(
ctx
,
put_bits_count
(
pbc
),
name
,
subscripts
,
bits
,
value
);
}
}
if
(
width
<
32
)
if
(
width
<
32
)
...
...
libavcodec/cbs_h2645.c
View file @
300ef253
...
@@ -32,7 +32,8 @@
...
@@ -32,7 +32,8 @@
static
int
cbs_read_ue_golomb
(
CodedBitstreamContext
*
ctx
,
GetBitContext
*
gbc
,
static
int
cbs_read_ue_golomb
(
CodedBitstreamContext
*
ctx
,
GetBitContext
*
gbc
,
const
char
*
name
,
uint32_t
*
write_to
,
const
char
*
name
,
const
int
*
subscripts
,
uint32_t
*
write_to
,
uint32_t
range_min
,
uint32_t
range_max
)
uint32_t
range_min
,
uint32_t
range_max
)
{
{
uint32_t
value
;
uint32_t
value
;
...
@@ -68,7 +69,8 @@ static int cbs_read_ue_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc,
...
@@ -68,7 +69,8 @@ static int cbs_read_ue_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc,
--
value
;
--
value
;
if
(
ctx
->
trace_enable
)
if
(
ctx
->
trace_enable
)
ff_cbs_trace_syntax_element
(
ctx
,
position
,
name
,
bits
,
value
);
ff_cbs_trace_syntax_element
(
ctx
,
position
,
name
,
subscripts
,
bits
,
value
);
if
(
value
<
range_min
||
value
>
range_max
)
{
if
(
value
<
range_min
||
value
>
range_max
)
{
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"%s out of range: "
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"%s out of range: "
...
@@ -82,7 +84,8 @@ static int cbs_read_ue_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc,
...
@@ -82,7 +84,8 @@ static int cbs_read_ue_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc,
}
}
static
int
cbs_read_se_golomb
(
CodedBitstreamContext
*
ctx
,
GetBitContext
*
gbc
,
static
int
cbs_read_se_golomb
(
CodedBitstreamContext
*
ctx
,
GetBitContext
*
gbc
,
const
char
*
name
,
int32_t
*
write_to
,
const
char
*
name
,
const
int
*
subscripts
,
int32_t
*
write_to
,
int32_t
range_min
,
int32_t
range_max
)
int32_t
range_min
,
int32_t
range_max
)
{
{
int32_t
value
;
int32_t
value
;
...
@@ -122,7 +125,8 @@ static int cbs_read_se_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc,
...
@@ -122,7 +125,8 @@ static int cbs_read_se_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc,
value
=
v
/
2
;
value
=
v
/
2
;
if
(
ctx
->
trace_enable
)
if
(
ctx
->
trace_enable
)
ff_cbs_trace_syntax_element
(
ctx
,
position
,
name
,
bits
,
value
);
ff_cbs_trace_syntax_element
(
ctx
,
position
,
name
,
subscripts
,
bits
,
value
);
if
(
value
<
range_min
||
value
>
range_max
)
{
if
(
value
<
range_min
||
value
>
range_max
)
{
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"%s out of range: "
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"%s out of range: "
...
@@ -136,7 +140,8 @@ static int cbs_read_se_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc,
...
@@ -136,7 +140,8 @@ static int cbs_read_se_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc,
}
}
static
int
cbs_write_ue_golomb
(
CodedBitstreamContext
*
ctx
,
PutBitContext
*
pbc
,
static
int
cbs_write_ue_golomb
(
CodedBitstreamContext
*
ctx
,
PutBitContext
*
pbc
,
const
char
*
name
,
uint32_t
value
,
const
char
*
name
,
const
int
*
subscripts
,
uint32_t
value
,
uint32_t
range_min
,
uint32_t
range_max
)
uint32_t
range_min
,
uint32_t
range_max
)
{
{
int
len
;
int
len
;
...
@@ -164,7 +169,8 @@ static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
...
@@ -164,7 +169,8 @@ static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
bits
[
len
+
i
+
1
]
=
(
value
+
1
)
>>
(
len
-
i
-
1
)
&
1
?
'1'
:
'0'
;
bits
[
len
+
i
+
1
]
=
(
value
+
1
)
>>
(
len
-
i
-
1
)
&
1
?
'1'
:
'0'
;
bits
[
len
+
len
+
1
]
=
0
;
bits
[
len
+
len
+
1
]
=
0
;
ff_cbs_trace_syntax_element
(
ctx
,
put_bits_count
(
pbc
),
name
,
bits
,
value
);
ff_cbs_trace_syntax_element
(
ctx
,
put_bits_count
(
pbc
),
name
,
subscripts
,
bits
,
value
);
}
}
put_bits
(
pbc
,
len
,
0
);
put_bits
(
pbc
,
len
,
0
);
...
@@ -177,7 +183,8 @@ static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
...
@@ -177,7 +183,8 @@ static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
}
}
static
int
cbs_write_se_golomb
(
CodedBitstreamContext
*
ctx
,
PutBitContext
*
pbc
,
static
int
cbs_write_se_golomb
(
CodedBitstreamContext
*
ctx
,
PutBitContext
*
pbc
,
const
char
*
name
,
int32_t
value
,
const
char
*
name
,
const
int
*
subscripts
,
int32_t
value
,
int32_t
range_min
,
int32_t
range_max
)
int32_t
range_min
,
int32_t
range_max
)
{
{
int
len
;
int
len
;
...
@@ -213,7 +220,8 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
...
@@ -213,7 +220,8 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
bits
[
len
+
i
+
1
]
=
(
uvalue
+
1
)
>>
(
len
-
i
-
1
)
&
1
?
'1'
:
'0'
;
bits
[
len
+
i
+
1
]
=
(
uvalue
+
1
)
>>
(
len
-
i
-
1
)
&
1
?
'1'
:
'0'
;
bits
[
len
+
len
+
1
]
=
0
;
bits
[
len
+
len
+
1
]
=
0
;
ff_cbs_trace_syntax_element
(
ctx
,
put_bits_count
(
pbc
),
name
,
bits
,
value
);
ff_cbs_trace_syntax_element
(
ctx
,
put_bits_count
(
pbc
),
name
,
subscripts
,
bits
,
value
);
}
}
put_bits
(
pbc
,
len
,
0
);
put_bits
(
pbc
,
len
,
0
);
...
@@ -239,9 +247,28 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
...
@@ -239,9 +247,28 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
#define FUNC_H264(rw, name) FUNC_NAME(rw, h264, name)
#define FUNC_H264(rw, name) FUNC_NAME(rw, h264, name)
#define FUNC_H265(rw, name) FUNC_NAME(rw, h265, name)
#define FUNC_H265(rw, name) FUNC_NAME(rw, h265, name)
#define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
#define u(width, name, range_min, range_max) \
xu(width, name, current->name, range_min, range_max, 0)
#define flag(name) u(1, name, 0, 1)
#define ue(name, range_min, range_max) \
xue(name, current->name, range_min, range_max, 0)
#define se(name, range_min, range_max) \
xse(name, current->name, range_min, range_max, 0)
#define us(width, name, range_min, range_max, subs, ...) \
xu(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)
#define flags(name, subs, ...) \
xu(1, name, current->name, 0, 1, subs, __VA_ARGS__)
#define ues(name, range_min, range_max, subs, ...) \
xue(name, current->name, range_min, range_max, subs, __VA_ARGS__)
#define ses(name, range_min, range_max, subs, ...) \
xse(name, current->name, range_min, range_max, subs, __VA_ARGS__)
#define fixed(width, name, value) do { \
#define fixed(width, name, value) do { \
av_unused uint32_t fixed_value = value; \
av_unused uint32_t fixed_value = value; \
xu(width, name, fixed_value, value, value); \
xu(width, name, fixed_value, value, value
, 0
); \
} while (0)
} while (0)
...
@@ -249,34 +276,29 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
...
@@ -249,34 +276,29 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
#define READWRITE read
#define READWRITE read
#define RWContext GetBitContext
#define RWContext GetBitContext
#define xu(width, name, var, range_min, range_max) do { \
#define xu(width, name, var, range_min, range_max
, subs, ...
) do { \
uint32_t value = range_min; \
uint32_t value = range_min; \
CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \
CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
&value, range_min, range_max)); \
var = value; \
var = value; \
} while (0)
} while (0)
#define xue(name, var, range_min, range_max) do { \
#define xue(name, var, range_min, range_max
, subs, ...
) do { \
uint32_t value = range_min; \
uint32_t value = range_min; \
CHECK(cbs_read_ue_golomb(ctx, rw, #name, \
CHECK(cbs_read_ue_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
&value, range_min, range_max)); \
var = value; \
var = value; \
} while (0)
} while (0)
#define xse(name, var, range_min, range_max) do { \
#define xse(name, var, range_min, range_max
, subs, ...
) do { \
int32_t value = range_min; \
int32_t value = range_min; \
CHECK(cbs_read_se_golomb(ctx, rw, #name, \
CHECK(cbs_read_se_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
&value, range_min, range_max)); \
var = value; \
var = value; \
} while (0)
} while (0)
#define u(width, name, range_min, range_max) \
xu(width, name, current->name, range_min, range_max)
#define flag(name) u(1, name, 0, 1)
#define ue(name, range_min, range_max) \
xue(name, current->name, range_min, range_max)
#define se(name, range_min, range_max) \
xse(name, current->name, range_min, range_max)
#define infer(name, value) do { \
#define infer(name, value) do { \
current->name = value; \
current->name = value; \
} while (0)
} while (0)
...
@@ -316,10 +338,6 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
...
@@ -316,10 +338,6 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
#undef xu
#undef xu
#undef xue
#undef xue
#undef xse
#undef xse
#undef u
#undef flag
#undef ue
#undef se
#undef infer
#undef infer
#undef more_rbsp_data
#undef more_rbsp_data
#undef byte_alignment
#undef byte_alignment
...
@@ -330,30 +348,25 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
...
@@ -330,30 +348,25 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
#define READWRITE write
#define READWRITE write
#define RWContext PutBitContext
#define RWContext PutBitContext
#define xu(width, name, var, range_min, range_max) do { \
#define xu(width, name, var, range_min, range_max
, subs, ...
) do { \
uint32_t value = var; \
uint32_t value = var; \
CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \
CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
value, range_min, range_max)); \
} while (0)
} while (0)
#define xue(name, var, range_min, range_max) do { \
#define xue(name, var, range_min, range_max
, subs, ...
) do { \
uint32_t value = var; \
uint32_t value = var; \
CHECK(cbs_write_ue_golomb(ctx, rw, #name, \
CHECK(cbs_write_ue_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
value, range_min, range_max)); \
} while (0)
} while (0)
#define xse(name, var, range_min, range_max) do { \
#define xse(name, var, range_min, range_max
, subs, ...
) do { \
int32_t value = var; \
int32_t value = var; \
CHECK(cbs_write_se_golomb(ctx, rw, #name, \
CHECK(cbs_write_se_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
value, range_min, range_max)); \
} while (0)
} while (0)
#define u(width, name, range_min, range_max) \
xu(width, name, current->name, range_min, range_max)
#define flag(name) u(1, name, 0, 1)
#define ue(name, range_min, range_max) \
xue(name, current->name, range_min, range_max)
#define se(name, range_min, range_max) \
xse(name, current->name, range_min, range_max)
#define infer(name, value) do { \
#define infer(name, value) do { \
if (current->name != (value)) { \
if (current->name != (value)) { \
av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \
av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \
...
...
libavcodec/cbs_h264_syntax_template.c
View file @
300ef253
...
@@ -76,7 +76,7 @@ static int FUNC(scaling_list)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -76,7 +76,7 @@ static int FUNC(scaling_list)(CodedBitstreamContext *ctx, RWContext *rw,
scale
=
8
;
scale
=
8
;
for
(
i
=
0
;
i
<
size_of_scaling_list
;
i
++
)
{
for
(
i
=
0
;
i
<
size_of_scaling_list
;
i
++
)
{
xse
(
delta_scale
,
current
->
delta_scale
[
i
],
-
128
,
+
127
);
ses
(
delta_scale
[
i
],
-
128
,
+
127
,
1
,
i
);
scale
=
(
scale
+
current
->
delta_scale
[
i
]
+
256
)
%
256
;
scale
=
(
scale
+
current
->
delta_scale
[
i
]
+
256
)
%
256
;
if
(
scale
==
0
)
if
(
scale
==
0
)
break
;
break
;
...
@@ -95,9 +95,9 @@ static int FUNC(hrd_parameters)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -95,9 +95,9 @@ static int FUNC(hrd_parameters)(CodedBitstreamContext *ctx, RWContext *rw,
u
(
4
,
cpb_size_scale
,
0
,
15
);
u
(
4
,
cpb_size_scale
,
0
,
15
);
for
(
i
=
0
;
i
<=
current
->
cpb_cnt_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<=
current
->
cpb_cnt_minus1
;
i
++
)
{
ue
(
bit_rate_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
);
ue
s
(
bit_rate_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
,
1
,
i
);
ue
(
cpb_size_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
);
ue
s
(
cpb_size_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
,
1
,
i
);
flag
(
cbr_flag
[
i
]
);
flag
s
(
cbr_flag
[
i
],
1
,
i
);
}
}
u
(
5
,
initial_cpb_removal_delay_length_minus1
,
0
,
31
);
u
(
5
,
initial_cpb_removal_delay_length_minus1
,
0
,
31
);
...
@@ -256,7 +256,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -256,7 +256,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
flag
(
seq_scaling_matrix_present_flag
);
flag
(
seq_scaling_matrix_present_flag
);
if
(
current
->
seq_scaling_matrix_present_flag
)
{
if
(
current
->
seq_scaling_matrix_present_flag
)
{
for
(
i
=
0
;
i
<
((
current
->
chroma_format_idc
!=
3
)
?
8
:
12
);
i
++
)
{
for
(
i
=
0
;
i
<
((
current
->
chroma_format_idc
!=
3
)
?
8
:
12
);
i
++
)
{
flag
(
seq_scaling_list_present_flag
[
i
]
);
flag
s
(
seq_scaling_list_present_flag
[
i
],
1
,
i
);
if
(
current
->
seq_scaling_list_present_flag
[
i
])
{
if
(
current
->
seq_scaling_list_present_flag
[
i
])
{
if
(
i
<
6
)
if
(
i
<
6
)
CHECK
(
FUNC
(
scaling_list
)(
ctx
,
rw
,
CHECK
(
FUNC
(
scaling_list
)(
ctx
,
rw
,
...
@@ -289,7 +289,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -289,7 +289,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
ue
(
num_ref_frames_in_pic_order_cnt_cycle
,
0
,
255
);
ue
(
num_ref_frames_in_pic_order_cnt_cycle
,
0
,
255
);
for
(
i
=
0
;
i
<
current
->
num_ref_frames_in_pic_order_cnt_cycle
;
i
++
)
for
(
i
=
0
;
i
<
current
->
num_ref_frames_in_pic_order_cnt_cycle
;
i
++
)
se
(
offset_for_ref_frame
[
i
],
INT32_MIN
+
1
,
INT32_MAX
);
se
s
(
offset_for_ref_frame
[
i
],
INT32_MIN
+
1
,
INT32_MAX
,
1
,
i
);
}
}
ue
(
max_num_ref_frames
,
0
,
H264_MAX_DPB_FRAMES
);
ue
(
max_num_ref_frames
,
0
,
H264_MAX_DPB_FRAMES
);
...
@@ -390,12 +390,13 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -390,12 +390,13 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw,
if
(
current
->
slice_group_map_type
==
0
)
{
if
(
current
->
slice_group_map_type
==
0
)
{
for
(
iGroup
=
0
;
iGroup
<=
current
->
num_slice_groups_minus1
;
iGroup
++
)
for
(
iGroup
=
0
;
iGroup
<=
current
->
num_slice_groups_minus1
;
iGroup
++
)
ue
(
run_length_minus1
[
iGroup
],
0
,
pic_size
-
1
);
ue
s
(
run_length_minus1
[
iGroup
],
0
,
pic_size
-
1
,
1
,
iGroup
);
}
else
if
(
current
->
slice_group_map_type
==
2
)
{
}
else
if
(
current
->
slice_group_map_type
==
2
)
{
for
(
iGroup
=
0
;
iGroup
<
current
->
num_slice_groups_minus1
;
iGroup
++
)
{
for
(
iGroup
=
0
;
iGroup
<
current
->
num_slice_groups_minus1
;
iGroup
++
)
{
ue
(
top_left
[
iGroup
],
0
,
pic_size
-
1
);
ues
(
top_left
[
iGroup
],
0
,
pic_size
-
1
,
1
,
iGroup
);
ue
(
bottom_right
[
iGroup
],
current
->
top_left
[
iGroup
],
pic_size
-
1
);
ues
(
bottom_right
[
iGroup
],
current
->
top_left
[
iGroup
],
pic_size
-
1
,
1
,
iGroup
);
}
}
}
else
if
(
current
->
slice_group_map_type
==
3
||
}
else
if
(
current
->
slice_group_map_type
==
3
||
current
->
slice_group_map_type
==
4
||
current
->
slice_group_map_type
==
4
||
...
@@ -408,8 +409,8 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -408,8 +409,8 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw,
allocate
(
current
->
slice_group_id
,
allocate
(
current
->
slice_group_id
,
current
->
pic_size_in_map_units_minus1
+
1
);
current
->
pic_size_in_map_units_minus1
+
1
);
for
(
i
=
0
;
i
<=
current
->
pic_size_in_map_units_minus1
;
i
++
)
for
(
i
=
0
;
i
<=
current
->
pic_size_in_map_units_minus1
;
i
++
)
u
(
av_log2
(
2
*
current
->
num_slice_groups_minus1
+
1
),
u
s
(
av_log2
(
2
*
current
->
num_slice_groups_minus1
+
1
),
slice_group_id
[
i
],
0
,
current
->
num_slice_groups_minus1
);
slice_group_id
[
i
],
0
,
current
->
num_slice_groups_minus1
,
1
,
i
);
}
}
}
}
...
@@ -435,7 +436,7 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -435,7 +436,7 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw,
if
(
current
->
pic_scaling_matrix_present_flag
)
{
if
(
current
->
pic_scaling_matrix_present_flag
)
{
for
(
i
=
0
;
i
<
6
+
(((
sps
->
chroma_format_idc
!=
3
)
?
2
:
6
)
*
for
(
i
=
0
;
i
<
6
+
(((
sps
->
chroma_format_idc
!=
3
)
?
2
:
6
)
*
current
->
transform_8x8_mode_flag
);
i
++
)
{
current
->
transform_8x8_mode_flag
);
i
++
)
{
flag
(
pic_scaling_list_present_flag
[
i
]
);
flag
s
(
pic_scaling_list_present_flag
[
i
],
1
,
i
);
if
(
current
->
pic_scaling_list_present_flag
[
i
])
{
if
(
current
->
pic_scaling_list_present_flag
[
i
])
{
if
(
i
<
6
)
if
(
i
<
6
)
CHECK
(
FUNC
(
scaling_list
)(
ctx
,
rw
,
CHECK
(
FUNC
(
scaling_list
)(
ctx
,
rw
,
...
@@ -483,10 +484,10 @@ static int FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -483,10 +484,10 @@ static int FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw,
length
=
sps
->
vui
.
nal_hrd_parameters
.
initial_cpb_removal_delay_length_minus1
+
1
;
length
=
sps
->
vui
.
nal_hrd_parameters
.
initial_cpb_removal_delay_length_minus1
+
1
;
xu
(
length
,
initial_cpb_removal_delay
[
SchedSelIdx
],
xu
(
length
,
initial_cpb_removal_delay
[
SchedSelIdx
],
current
->
nal
.
initial_cpb_removal_delay
[
i
],
current
->
nal
.
initial_cpb_removal_delay
[
i
],
1
,
MAX_UINT_BITS
(
length
));
1
,
MAX_UINT_BITS
(
length
)
,
1
,
i
);
xu
(
length
,
initial_cpb_removal_delay_offset
[
SchedSelIdx
],
xu
(
length
,
initial_cpb_removal_delay_offset
[
SchedSelIdx
],
current
->
nal
.
initial_cpb_removal_delay_offset
[
i
],
current
->
nal
.
initial_cpb_removal_delay_offset
[
i
],
0
,
MAX_UINT_BITS
(
length
));
0
,
MAX_UINT_BITS
(
length
)
,
1
,
i
);
}
}
}
}
...
@@ -495,10 +496,10 @@ static int FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -495,10 +496,10 @@ static int FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw,
length
=
sps
->
vui
.
vcl_hrd_parameters
.
initial_cpb_removal_delay_length_minus1
+
1
;
length
=
sps
->
vui
.
vcl_hrd_parameters
.
initial_cpb_removal_delay_length_minus1
+
1
;
xu
(
length
,
initial_cpb_removal_delay
[
SchedSelIdx
],
xu
(
length
,
initial_cpb_removal_delay
[
SchedSelIdx
],
current
->
vcl
.
initial_cpb_removal_delay
[
i
],
current
->
vcl
.
initial_cpb_removal_delay
[
i
],
1
,
MAX_UINT_BITS
(
length
));
1
,
MAX_UINT_BITS
(
length
)
,
1
,
i
);
xu
(
length
,
initial_cpb_removal_delay_offset
[
SchedSelIdx
],
xu
(
length
,
initial_cpb_removal_delay_offset
[
SchedSelIdx
],
current
->
vcl
.
initial_cpb_removal_delay_offset
[
i
],
current
->
vcl
.
initial_cpb_removal_delay_offset
[
i
],
0
,
MAX_UINT_BITS
(
length
));
0
,
MAX_UINT_BITS
(
length
)
,
1
,
i
);
}
}
}
}
...
@@ -616,7 +617,7 @@ static int FUNC(sei_pic_timing)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -616,7 +617,7 @@ static int FUNC(sei_pic_timing)(CodedBitstreamContext *ctx, RWContext *rw,
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
for
(
i
=
0
;
i
<
num_clock_ts
[
current
->
pic_struct
];
i
++
)
{
for
(
i
=
0
;
i
<
num_clock_ts
[
current
->
pic_struct
];
i
++
)
{
flag
(
clock_timestamp_flag
[
i
]
);
flag
s
(
clock_timestamp_flag
[
i
],
1
,
i
);
if
(
current
->
clock_timestamp_flag
[
i
])
if
(
current
->
clock_timestamp_flag
[
i
])
CHECK
(
FUNC
(
sei_pic_timestamp
)(
ctx
,
rw
,
&
current
->
timestamp
[
i
]));
CHECK
(
FUNC
(
sei_pic_timestamp
)(
ctx
,
rw
,
&
current
->
timestamp
[
i
]));
}
}
...
@@ -652,7 +653,7 @@ static int FUNC(sei_user_data_registered)(CodedBitstreamContext *ctx, RWContext
...
@@ -652,7 +653,7 @@ static int FUNC(sei_user_data_registered)(CodedBitstreamContext *ctx, RWContext
allocate
(
current
->
data
,
current
->
data_length
);
allocate
(
current
->
data
,
current
->
data_length
);
for
(
j
=
0
;
j
<
current
->
data_length
;
j
++
)
for
(
j
=
0
;
j
<
current
->
data_length
;
j
++
)
xu
(
8
,
itu_t_t35_payload_byte
,
current
->
data
[
j
],
0x00
,
0xff
);
xu
(
8
,
itu_t_t35_payload_byte
[
i
],
current
->
data
[
j
],
0x00
,
0xff
,
1
,
i
+
j
);
return
0
;
return
0
;
}
}
...
@@ -674,15 +675,13 @@ static int FUNC(sei_user_data_unregistered)(CodedBitstreamContext *ctx, RWContex
...
@@ -674,15 +675,13 @@ static int FUNC(sei_user_data_unregistered)(CodedBitstreamContext *ctx, RWContex
*
payload_size
=
16
+
current
->
data_length
;
*
payload_size
=
16
+
current
->
data_length
;
#endif
#endif
for
(
i
=
0
;
i
<
16
;
i
++
)
{
for
(
i
=
0
;
i
<
16
;
i
++
)
xu
(
8
,
uuid_iso_iec_11578
,
us
(
8
,
uuid_iso_iec_11578
[
i
],
0x00
,
0xff
,
1
,
i
);
current
->
uuid_iso_iec_11578
[
i
],
0x00
,
0xff
);
}
allocate
(
current
->
data
,
current
->
data_length
);
allocate
(
current
->
data
,
current
->
data_length
);
for
(
i
=
0
;
i
<
current
->
data_length
;
i
++
)
for
(
i
=
0
;
i
<
current
->
data_length
;
i
++
)
xu
(
8
,
user_data_payload_byte
,
current
->
data
[
i
],
0x00
,
0xff
);
xu
(
8
,
user_data_payload_byte
[
i
],
current
->
data
[
i
],
0x00
,
0xff
,
1
,
i
);
return
0
;
return
0
;
}
}
...
@@ -764,7 +763,7 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -764,7 +763,7 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
{
{
allocate
(
current
->
payload
.
other
.
data
,
current
->
payload_size
);
allocate
(
current
->
payload
.
other
.
data
,
current
->
payload_size
);
for
(
i
=
0
;
i
<
current
->
payload_size
;
i
++
)
for
(
i
=
0
;
i
<
current
->
payload_size
;
i
++
)
xu
(
8
,
payload_byte
,
current
->
payload
.
other
.
data
[
i
],
0
,
255
);
xu
(
8
,
payload_byte
,
current
->
payload
.
other
.
data
[
i
],
0
,
255
,
1
,
i
);
}
}
}
}
...
@@ -811,14 +810,14 @@ static int FUNC(sei)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -811,14 +810,14 @@ static int FUNC(sei)(CodedBitstreamContext *ctx, RWContext *rw,
fixed
(
8
,
ff_byte
,
0xff
);
fixed
(
8
,
ff_byte
,
0xff
);
payload_type
+=
255
;
payload_type
+=
255
;
}
}
xu
(
8
,
last_payload_type_byte
,
tmp
,
0
,
254
);
xu
(
8
,
last_payload_type_byte
,
tmp
,
0
,
254
,
0
);
payload_type
+=
tmp
;
payload_type
+=
tmp
;
while
(
show_bits
(
rw
,
8
)
==
0xff
)
{
while
(
show_bits
(
rw
,
8
)
==
0xff
)
{
fixed
(
8
,
ff_byte
,
0xff
);
fixed
(
8
,
ff_byte
,
0xff
);
payload_size
+=
255
;
payload_size
+=
255
;
}
}
xu
(
8
,
last_payload_size_byte
,
tmp
,
0
,
254
);
xu
(
8
,
last_payload_size_byte
,
tmp
,
0
,
254
,
0
);
payload_size
+=
tmp
;
payload_size
+=
tmp
;
current
->
payload
[
k
].
payload_type
=
payload_type
;
current
->
payload
[
k
].
payload_type
=
payload_type
;
...
@@ -854,14 +853,14 @@ static int FUNC(sei)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -854,14 +853,14 @@ static int FUNC(sei)(CodedBitstreamContext *ctx, RWContext *rw,
fixed
(
8
,
ff_byte
,
0xff
);
fixed
(
8
,
ff_byte
,
0xff
);
tmp
-=
255
;
tmp
-=
255
;
}
}
xu
(
8
,
last_payload_type_byte
,
tmp
,
0
,
254
);
xu
(
8
,
last_payload_type_byte
,
tmp
,
0
,
254
,
0
);
tmp
=
current
->
payload
[
k
].
payload_size
;
tmp
=
current
->
payload
[
k
].
payload_size
;
while
(
tmp
>=
255
)
{
while
(
tmp
>=
255
)
{
fixed
(
8
,
ff_byte
,
0xff
);
fixed
(
8
,
ff_byte
,
0xff
);
tmp
-=
255
;
tmp
-=
255
;
}
}
xu
(
8
,
last_payload_size_byte
,
tmp
,
0
,
254
);
xu
(
8
,
last_payload_size_byte
,
tmp
,
0
,
254
,
0
);
CHECK
(
FUNC
(
sei_payload
)(
ctx
,
rw
,
&
current
->
payload
[
k
]));
CHECK
(
FUNC
(
sei_payload
)(
ctx
,
rw
,
&
current
->
payload
[
k
]));
}
}
...
@@ -903,7 +902,7 @@ static int FUNC(ref_pic_list_modification)(CodedBitstreamContext *ctx, RWContext
...
@@ -903,7 +902,7 @@ static int FUNC(ref_pic_list_modification)(CodedBitstreamContext *ctx, RWContext
if
(
current
->
ref_pic_list_modification_flag_l0
)
{
if
(
current
->
ref_pic_list_modification_flag_l0
)
{
for
(
i
=
0
;
i
<
H264_MAX_RPLM_COUNT
;
i
++
)
{
for
(
i
=
0
;
i
<
H264_MAX_RPLM_COUNT
;
i
++
)
{
xue
(
modification_of_pic_nums_idc
,
xue
(
modification_of_pic_nums_idc
,
current
->
rplm_l0
[
i
].
modification_of_pic_nums_idc
,
0
,
3
);
current
->
rplm_l0
[
i
].
modification_of_pic_nums_idc
,
0
,
3
,
0
);
mopn
=
current
->
rplm_l0
[
i
].
modification_of_pic_nums_idc
;
mopn
=
current
->
rplm_l0
[
i
].
modification_of_pic_nums_idc
;
if
(
mopn
==
3
)
if
(
mopn
==
3
)
...
@@ -913,11 +912,11 @@ static int FUNC(ref_pic_list_modification)(CodedBitstreamContext *ctx, RWContext
...
@@ -913,11 +912,11 @@ static int FUNC(ref_pic_list_modification)(CodedBitstreamContext *ctx, RWContext
xue
(
abs_diff_pic_num_minus1
,
xue
(
abs_diff_pic_num_minus1
,
current
->
rplm_l0
[
i
].
abs_diff_pic_num_minus1
,
current
->
rplm_l0
[
i
].
abs_diff_pic_num_minus1
,
0
,
(
1
+
current
->
field_pic_flag
)
*
0
,
(
1
+
current
->
field_pic_flag
)
*
(
1
<<
(
sps
->
log2_max_frame_num_minus4
+
4
)));
(
1
<<
(
sps
->
log2_max_frame_num_minus4
+
4
))
,
0
);
else
if
(
mopn
==
2
)
else
if
(
mopn
==
2
)
xue
(
long_term_pic_num
,
xue
(
long_term_pic_num
,
current
->
rplm_l0
[
i
].
long_term_pic_num
,
current
->
rplm_l0
[
i
].
long_term_pic_num
,
0
,
sps
->
max_num_ref_frames
-
1
);
0
,
sps
->
max_num_ref_frames
-
1
,
0
);
}
}
}
}
}
}
...
@@ -927,7 +926,7 @@ static int FUNC(ref_pic_list_modification)(CodedBitstreamContext *ctx, RWContext
...
@@ -927,7 +926,7 @@ static int FUNC(ref_pic_list_modification)(CodedBitstreamContext *ctx, RWContext
if
(
current
->
ref_pic_list_modification_flag_l1
)
{
if
(
current
->
ref_pic_list_modification_flag_l1
)
{
for
(
i
=
0
;
i
<
H264_MAX_RPLM_COUNT
;
i
++
)
{
for
(
i
=
0
;
i
<
H264_MAX_RPLM_COUNT
;
i
++
)
{
xue
(
modification_of_pic_nums_idc
,
xue
(
modification_of_pic_nums_idc
,
current
->
rplm_l1
[
i
].
modification_of_pic_nums_idc
,
0
,
3
);
current
->
rplm_l1
[
i
].
modification_of_pic_nums_idc
,
0
,
3
,
0
);
mopn
=
current
->
rplm_l1
[
i
].
modification_of_pic_nums_idc
;
mopn
=
current
->
rplm_l1
[
i
].
modification_of_pic_nums_idc
;
if
(
mopn
==
3
)
if
(
mopn
==
3
)
...
@@ -937,11 +936,11 @@ static int FUNC(ref_pic_list_modification)(CodedBitstreamContext *ctx, RWContext
...
@@ -937,11 +936,11 @@ static int FUNC(ref_pic_list_modification)(CodedBitstreamContext *ctx, RWContext
xue
(
abs_diff_pic_num_minus1
,
xue
(
abs_diff_pic_num_minus1
,
current
->
rplm_l1
[
i
].
abs_diff_pic_num_minus1
,
current
->
rplm_l1
[
i
].
abs_diff_pic_num_minus1
,
0
,
(
1
+
current
->
field_pic_flag
)
*
0
,
(
1
+
current
->
field_pic_flag
)
*
(
1
<<
(
sps
->
log2_max_frame_num_minus4
+
4
)));
(
1
<<
(
sps
->
log2_max_frame_num_minus4
+
4
))
,
0
);
else
if
(
mopn
==
2
)
else
if
(
mopn
==
2
)
xue
(
long_term_pic_num
,
xue
(
long_term_pic_num
,
current
->
rplm_l1
[
i
].
long_term_pic_num
,
current
->
rplm_l1
[
i
].
long_term_pic_num
,
0
,
sps
->
max_num_ref_frames
-
1
);
0
,
sps
->
max_num_ref_frames
-
1
,
0
);
}
}
}
}
}
}
...
@@ -964,17 +963,17 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -964,17 +963,17 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
ue
(
chroma_log2_weight_denom
,
0
,
7
);
ue
(
chroma_log2_weight_denom
,
0
,
7
);
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l0_active_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l0_active_minus1
;
i
++
)
{
flag
(
luma_weight_l0_flag
[
i
]
);
flag
s
(
luma_weight_l0_flag
[
i
],
1
,
i
);
if
(
current
->
luma_weight_l0_flag
[
i
])
{
if
(
current
->
luma_weight_l0_flag
[
i
])
{
se
(
luma_weight_l0
[
i
],
-
128
,
+
127
);
se
s
(
luma_weight_l0
[
i
],
-
128
,
+
127
,
1
,
i
);
se
(
luma_offset_l0
[
i
],
-
128
,
+
127
);
se
s
(
luma_offset_l0
[
i
],
-
128
,
+
127
,
1
,
i
);
}
}
if
(
chroma
)
{
if
(
chroma
)
{
flag
(
chroma_weight_l0_flag
[
i
]
);
flag
s
(
chroma_weight_l0_flag
[
i
],
1
,
i
);
if
(
current
->
chroma_weight_l0_flag
[
i
])
{
if
(
current
->
chroma_weight_l0_flag
[
i
])
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
se
(
chroma_weight_l0
[
i
][
j
],
-
128
,
+
127
);
se
s
(
chroma_weight_l0
[
i
][
j
],
-
128
,
+
127
,
2
,
i
,
j
);
se
(
chroma_offset_l0
[
i
][
j
],
-
128
,
+
127
);
se
s
(
chroma_offset_l0
[
i
][
j
],
-
128
,
+
127
,
2
,
i
,
j
);
}
}
}
}
}
}
...
@@ -982,17 +981,17 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -982,17 +981,17 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
if
(
current
->
slice_type
%
5
==
1
)
{
if
(
current
->
slice_type
%
5
==
1
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l1_active_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l1_active_minus1
;
i
++
)
{
flag
(
luma_weight_l1_flag
[
i
]
);
flag
s
(
luma_weight_l1_flag
[
i
],
1
,
i
);
if
(
current
->
luma_weight_l1_flag
[
i
])
{
if
(
current
->
luma_weight_l1_flag
[
i
])
{
se
(
luma_weight_l1
[
i
],
-
128
,
+
127
);
se
s
(
luma_weight_l1
[
i
],
-
128
,
+
127
,
1
,
i
);
se
(
luma_offset_l1
[
i
],
-
128
,
+
127
);
se
s
(
luma_offset_l1
[
i
],
-
128
,
+
127
,
1
,
i
);
}
}
if
(
chroma
)
{
if
(
chroma
)
{
flag
(
chroma_weight_l1_flag
[
i
]
);
flag
s
(
chroma_weight_l1_flag
[
i
],
1
,
i
);
if
(
current
->
chroma_weight_l1_flag
[
i
])
{
if
(
current
->
chroma_weight_l1_flag
[
i
])
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
se
(
chroma_weight_l1
[
i
][
j
],
-
128
,
+
127
);
se
s
(
chroma_weight_l1
[
i
][
j
],
-
128
,
+
127
,
2
,
i
,
j
);
se
(
chroma_offset_l1
[
i
][
j
],
-
128
,
+
127
);
se
s
(
chroma_offset_l1
[
i
][
j
],
-
128
,
+
127
,
2
,
i
,
j
);
}
}
}
}
}
}
...
@@ -1019,7 +1018,7 @@ static int FUNC(dec_ref_pic_marking)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -1019,7 +1018,7 @@ static int FUNC(dec_ref_pic_marking)(CodedBitstreamContext *ctx, RWContext *rw,
for
(
i
=
0
;
i
<
H264_MAX_MMCO_COUNT
;
i
++
)
{
for
(
i
=
0
;
i
<
H264_MAX_MMCO_COUNT
;
i
++
)
{
xue
(
memory_management_control_operation
,
xue
(
memory_management_control_operation
,
current
->
mmco
[
i
].
memory_management_control_operation
,
current
->
mmco
[
i
].
memory_management_control_operation
,
0
,
6
);
0
,
6
,
0
);
mmco
=
current
->
mmco
[
i
].
memory_management_control_operation
;
mmco
=
current
->
mmco
[
i
].
memory_management_control_operation
;
if
(
mmco
==
0
)
if
(
mmco
==
0
)
...
@@ -1028,19 +1027,19 @@ static int FUNC(dec_ref_pic_marking)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -1028,19 +1027,19 @@ static int FUNC(dec_ref_pic_marking)(CodedBitstreamContext *ctx, RWContext *rw,
if
(
mmco
==
1
||
mmco
==
3
)
if
(
mmco
==
1
||
mmco
==
3
)
xue
(
difference_of_pic_nums_minus1
,
xue
(
difference_of_pic_nums_minus1
,
current
->
mmco
[
i
].
difference_of_pic_nums_minus1
,
current
->
mmco
[
i
].
difference_of_pic_nums_minus1
,
0
,
INT32_MAX
);
0
,
INT32_MAX
,
0
);
if
(
mmco
==
2
)
if
(
mmco
==
2
)
xue
(
long_term_pic_num
,
xue
(
long_term_pic_num
,
current
->
mmco
[
i
].
long_term_pic_num
,
current
->
mmco
[
i
].
long_term_pic_num
,
0
,
sps
->
max_num_ref_frames
-
1
);
0
,
sps
->
max_num_ref_frames
-
1
,
0
);
if
(
mmco
==
3
||
mmco
==
6
)
if
(
mmco
==
3
||
mmco
==
6
)
xue
(
long_term_frame_idx
,
xue
(
long_term_frame_idx
,
current
->
mmco
[
i
].
long_term_frame_idx
,
current
->
mmco
[
i
].
long_term_frame_idx
,
0
,
sps
->
max_num_ref_frames
-
1
);
0
,
sps
->
max_num_ref_frames
-
1
,
0
);
if
(
mmco
==
4
)
if
(
mmco
==
4
)
xue
(
max_long_term_frame_idx_plus1
,
xue
(
max_long_term_frame_idx_plus1
,
current
->
mmco
[
i
].
max_long_term_frame_idx_plus1
,
current
->
mmco
[
i
].
max_long_term_frame_idx_plus1
,
0
,
sps
->
max_num_ref_frames
);
0
,
sps
->
max_num_ref_frames
,
0
);
}
}
if
(
i
==
H264_MAX_MMCO_COUNT
)
{
if
(
i
==
H264_MAX_MMCO_COUNT
)
{
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Too many "
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Too many "
...
...
libavcodec/cbs_h265_syntax_template.c
View file @
300ef253
...
@@ -74,13 +74,13 @@ static int FUNC(extension_data)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -74,13 +74,13 @@ static int FUNC(extension_data)(CodedBitstreamContext *ctx, RWContext *rw,
*
rw
=
start
;
*
rw
=
start
;
allocate
(
current
->
data
,
(
current
->
bit_length
+
7
)
/
8
);
allocate
(
current
->
data
,
(
current
->
bit_length
+
7
)
/
8
);
for
(
k
=
0
;
k
<
current
->
bit_length
;
k
++
)
{
for
(
k
=
0
;
k
<
current
->
bit_length
;
k
++
)
{
xu
(
1
,
extension_data
,
bit
,
0
,
1
);
xu
(
1
,
extension_data
,
bit
,
0
,
1
,
0
);
current
->
data
[
k
/
8
]
|=
bit
<<
(
7
-
k
%
8
);
current
->
data
[
k
/
8
]
|=
bit
<<
(
7
-
k
%
8
);
}
}
}
}
#else
#else
for
(
k
=
0
;
k
<
current
->
bit_length
;
k
++
)
for
(
k
=
0
;
k
<
current
->
bit_length
;
k
++
)
xu
(
1
,
extension_data
,
current
->
data
[
k
/
8
]
>>
(
7
-
k
%
8
),
0
,
1
);
xu
(
1
,
extension_data
,
current
->
data
[
k
/
8
]
>>
(
7
-
k
%
8
),
0
,
1
,
0
);
#endif
#endif
return
0
;
return
0
;
}
}
...
@@ -98,7 +98,7 @@ static int FUNC(profile_tier_level)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -98,7 +98,7 @@ static int FUNC(profile_tier_level)(CodedBitstreamContext *ctx, RWContext *rw,
u
(
5
,
general_profile_idc
,
0
,
31
);
u
(
5
,
general_profile_idc
,
0
,
31
);
for
(
j
=
0
;
j
<
32
;
j
++
)
for
(
j
=
0
;
j
<
32
;
j
++
)
flag
(
general_profile_compatibility_flag
[
j
]
);
flag
s
(
general_profile_compatibility_flag
[
j
],
1
,
j
);
flag
(
general_progressive_source_flag
);
flag
(
general_progressive_source_flag
);
flag
(
general_interlaced_source_flag
);
flag
(
general_interlaced_source_flag
);
...
@@ -148,8 +148,8 @@ static int FUNC(profile_tier_level)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -148,8 +148,8 @@ static int FUNC(profile_tier_level)(CodedBitstreamContext *ctx, RWContext *rw,
u
(
8
,
general_level_idc
,
0
,
255
);
u
(
8
,
general_level_idc
,
0
,
255
);
for
(
i
=
0
;
i
<
max_num_sub_layers_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<
max_num_sub_layers_minus1
;
i
++
)
{
flag
(
sub_layer_profile_present_flag
[
i
]
);
flag
s
(
sub_layer_profile_present_flag
[
i
],
1
,
i
);
flag
(
sub_layer_level_present_flag
[
i
]
);
flag
s
(
sub_layer_level_present_flag
[
i
],
1
,
i
);
}
}
if
(
max_num_sub_layers_minus1
>
0
)
{
if
(
max_num_sub_layers_minus1
>
0
)
{
...
@@ -180,13 +180,13 @@ static int FUNC(sub_layer_hrd_parameters)(CodedBitstreamContext *ctx, RWContext
...
@@ -180,13 +180,13 @@ static int FUNC(sub_layer_hrd_parameters)(CodedBitstreamContext *ctx, RWContext
current
=
&
hrd
->
vcl_sub_layer_hrd_parameters
[
sub_layer_id
];
current
=
&
hrd
->
vcl_sub_layer_hrd_parameters
[
sub_layer_id
];
for
(
i
=
0
;
i
<=
hrd
->
cpb_cnt_minus1
[
sub_layer_id
];
i
++
)
{
for
(
i
=
0
;
i
<=
hrd
->
cpb_cnt_minus1
[
sub_layer_id
];
i
++
)
{
ue
(
bit_rate_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
);
ue
s
(
bit_rate_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
,
1
,
i
);
ue
(
cpb_size_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
);
ue
s
(
cpb_size_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
,
1
,
i
);
if
(
hrd
->
sub_pic_hrd_params_present_flag
)
{
if
(
hrd
->
sub_pic_hrd_params_present_flag
)
{
ue
(
cpb_size_du_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
);
ue
s
(
cpb_size_du_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
,
1
,
i
);
ue
(
bit_rate_du_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
);
ue
s
(
bit_rate_du_value_minus1
[
i
],
0
,
UINT32_MAX
-
1
,
1
,
i
);
}
}
flag
(
cbr_flag
[
i
]
);
flag
s
(
cbr_flag
[
i
],
1
,
i
);
}
}
return
0
;
return
0
;
...
@@ -230,21 +230,21 @@ static int FUNC(hrd_parameters)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -230,21 +230,21 @@ static int FUNC(hrd_parameters)(CodedBitstreamContext *ctx, RWContext *rw,
}
}
for
(
i
=
0
;
i
<=
max_num_sub_layers_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<=
max_num_sub_layers_minus1
;
i
++
)
{
flag
(
fixed_pic_rate_general_flag
[
i
]
);
flag
s
(
fixed_pic_rate_general_flag
[
i
],
1
,
i
);
if
(
!
current
->
fixed_pic_rate_general_flag
[
i
])
if
(
!
current
->
fixed_pic_rate_general_flag
[
i
])
flag
(
fixed_pic_rate_within_cvs_flag
[
i
]
);
flag
s
(
fixed_pic_rate_within_cvs_flag
[
i
],
1
,
i
);
else
else
infer
(
fixed_pic_rate_within_cvs_flag
[
i
],
1
);
infer
(
fixed_pic_rate_within_cvs_flag
[
i
],
1
);
if
(
current
->
fixed_pic_rate_within_cvs_flag
[
i
])
{
if
(
current
->
fixed_pic_rate_within_cvs_flag
[
i
])
{
ue
(
elemental_duration_in_tc_minus1
[
i
],
0
,
2047
);
ue
s
(
elemental_duration_in_tc_minus1
[
i
],
0
,
2047
,
1
,
i
);
infer
(
low_delay_hrd_flag
[
i
],
0
);
infer
(
low_delay_hrd_flag
[
i
],
0
);
}
else
}
else
flag
(
low_delay_hrd_flag
[
i
]
);
flag
s
(
low_delay_hrd_flag
[
i
],
1
,
i
);
if
(
!
current
->
low_delay_hrd_flag
[
i
])
if
(
!
current
->
low_delay_hrd_flag
[
i
])
ue
(
cpb_cnt_minus1
[
i
],
0
,
31
);
ue
s
(
cpb_cnt_minus1
[
i
],
0
,
31
,
1
,
i
);
else
else
infer
(
cpb_cnt_minus1
[
i
],
0
);
infer
(
cpb_cnt_minus1
[
i
],
0
);
...
@@ -392,9 +392,12 @@ static int FUNC(vps)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -392,9 +392,12 @@ static int FUNC(vps)(CodedBitstreamContext *ctx, RWContext *rw,
for
(
i
=
(
current
->
vps_sub_layer_ordering_info_present_flag
?
for
(
i
=
(
current
->
vps_sub_layer_ordering_info_present_flag
?
0
:
current
->
vps_max_sub_layers_minus1
);
0
:
current
->
vps_max_sub_layers_minus1
);
i
<=
current
->
vps_max_sub_layers_minus1
;
i
++
)
{
i
<=
current
->
vps_max_sub_layers_minus1
;
i
++
)
{
ue
(
vps_max_dec_pic_buffering_minus1
[
i
],
0
,
HEVC_MAX_DPB_SIZE
-
1
);
ues
(
vps_max_dec_pic_buffering_minus1
[
i
],
ue
(
vps_max_num_reorder_pics
[
i
],
0
,
current
->
vps_max_dec_pic_buffering_minus1
[
i
]);
0
,
HEVC_MAX_DPB_SIZE
-
1
,
1
,
i
);
ue
(
vps_max_latency_increase_plus1
[
i
],
0
,
UINT32_MAX
-
1
);
ues
(
vps_max_num_reorder_pics
[
i
],
0
,
current
->
vps_max_dec_pic_buffering_minus1
[
i
],
1
,
i
);
ues
(
vps_max_latency_increase_plus1
[
i
],
0
,
UINT32_MAX
-
1
,
1
,
i
);
}
}
if
(
!
current
->
vps_sub_layer_ordering_info_present_flag
)
{
if
(
!
current
->
vps_sub_layer_ordering_info_present_flag
)
{
for
(
i
=
0
;
i
<
current
->
vps_max_sub_layers_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<
current
->
vps_max_sub_layers_minus1
;
i
++
)
{
...
@@ -411,7 +414,7 @@ static int FUNC(vps)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -411,7 +414,7 @@ static int FUNC(vps)(CodedBitstreamContext *ctx, RWContext *rw,
ue
(
vps_num_layer_sets_minus1
,
0
,
HEVC_MAX_LAYER_SETS
-
1
);
ue
(
vps_num_layer_sets_minus1
,
0
,
HEVC_MAX_LAYER_SETS
-
1
);
for
(
i
=
1
;
i
<=
current
->
vps_num_layer_sets_minus1
;
i
++
)
{
for
(
i
=
1
;
i
<=
current
->
vps_num_layer_sets_minus1
;
i
++
)
{
for
(
j
=
0
;
j
<=
current
->
vps_max_layer_id
;
j
++
)
for
(
j
=
0
;
j
<=
current
->
vps_max_layer_id
;
j
++
)
flag
(
layer_id_included_flag
[
i
][
j
]
);
flag
s
(
layer_id_included_flag
[
i
][
j
],
2
,
i
,
j
);
}
}
for
(
j
=
0
;
j
<=
current
->
vps_max_layer_id
;
j
++
)
for
(
j
=
0
;
j
<=
current
->
vps_max_layer_id
;
j
++
)
infer
(
layer_id_included_flag
[
0
][
j
],
j
==
0
);
infer
(
layer_id_included_flag
[
0
][
j
],
j
==
0
);
...
@@ -425,11 +428,11 @@ static int FUNC(vps)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -425,11 +428,11 @@ static int FUNC(vps)(CodedBitstreamContext *ctx, RWContext *rw,
ue
(
vps_num_ticks_poc_diff_one_minus1
,
0
,
UINT32_MAX
-
1
);
ue
(
vps_num_ticks_poc_diff_one_minus1
,
0
,
UINT32_MAX
-
1
);
ue
(
vps_num_hrd_parameters
,
0
,
current
->
vps_num_layer_sets_minus1
+
1
);
ue
(
vps_num_hrd_parameters
,
0
,
current
->
vps_num_layer_sets_minus1
+
1
);
for
(
i
=
0
;
i
<
current
->
vps_num_hrd_parameters
;
i
++
)
{
for
(
i
=
0
;
i
<
current
->
vps_num_hrd_parameters
;
i
++
)
{
ue
(
hrd_layer_set_idx
[
i
],
ue
s
(
hrd_layer_set_idx
[
i
],
current
->
vps_base_layer_internal_flag
?
0
:
1
,
current
->
vps_base_layer_internal_flag
?
0
:
1
,
current
->
vps_num_layer_sets_minus1
);
current
->
vps_num_layer_sets_minus1
,
1
,
i
);
if
(
i
>
0
)
if
(
i
>
0
)
flag
(
cprms_present_flag
[
i
]
);
flag
s
(
cprms_present_flag
[
i
],
1
,
i
);
else
else
infer
(
cprms_present_flag
[
0
],
1
);
infer
(
cprms_present_flag
[
0
],
1
);
...
@@ -483,9 +486,9 @@ static int FUNC(st_ref_pic_set)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -483,9 +486,9 @@ static int FUNC(st_ref_pic_set)(CodedBitstreamContext *ctx, RWContext *rw,
(
current
->
abs_delta_rps_minus1
+
1
);
(
current
->
abs_delta_rps_minus1
+
1
);
for
(
j
=
0
;
j
<=
num_delta_pocs
;
j
++
)
{
for
(
j
=
0
;
j
<=
num_delta_pocs
;
j
++
)
{
flag
(
used_by_curr_pic_flag
[
j
]
);
flag
s
(
used_by_curr_pic_flag
[
j
],
1
,
j
);
if
(
!
current
->
used_by_curr_pic_flag
[
j
])
if
(
!
current
->
used_by_curr_pic_flag
[
j
])
flag
(
use_delta_flag
[
j
]
);
flag
s
(
use_delta_flag
[
j
],
1
,
j
);
else
else
infer
(
use_delta_flag
[
j
],
1
);
infer
(
use_delta_flag
[
j
],
1
);
}
}
...
@@ -580,13 +583,13 @@ static int FUNC(st_ref_pic_set)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -580,13 +583,13 @@ static int FUNC(st_ref_pic_set)(CodedBitstreamContext *ctx, RWContext *rw,
ue
(
num_positive_pics
,
0
,
15
-
current
->
num_negative_pics
);
ue
(
num_positive_pics
,
0
,
15
-
current
->
num_negative_pics
);
for
(
i
=
0
;
i
<
current
->
num_negative_pics
;
i
++
)
{
for
(
i
=
0
;
i
<
current
->
num_negative_pics
;
i
++
)
{
ue
(
delta_poc_s0_minus1
[
i
],
0
,
INT16_MAX
);
ue
s
(
delta_poc_s0_minus1
[
i
],
0
,
INT16_MAX
,
1
,
i
);
flag
(
used_by_curr_pic_s0_flag
[
i
]
);
flag
s
(
used_by_curr_pic_s0_flag
[
i
],
1
,
i
);
}
}
for
(
i
=
0
;
i
<
current
->
num_positive_pics
;
i
++
)
{
for
(
i
=
0
;
i
<
current
->
num_positive_pics
;
i
++
)
{
ue
(
delta_poc_s1_minus1
[
i
],
0
,
INT16_MAX
);
ue
s
(
delta_poc_s1_minus1
[
i
],
0
,
INT16_MAX
,
1
,
i
);
flag
(
used_by_curr_pic_s1_flag
[
i
]
);
flag
s
(
used_by_curr_pic_s1_flag
[
i
],
1
,
i
);
}
}
}
}
...
@@ -601,18 +604,21 @@ static int FUNC(scaling_list_data)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -601,18 +604,21 @@ static int FUNC(scaling_list_data)(CodedBitstreamContext *ctx, RWContext *rw,
for
(
sizeId
=
0
;
sizeId
<
4
;
sizeId
++
)
{
for
(
sizeId
=
0
;
sizeId
<
4
;
sizeId
++
)
{
for
(
matrixId
=
0
;
matrixId
<
6
;
matrixId
+=
(
sizeId
==
3
?
3
:
1
))
{
for
(
matrixId
=
0
;
matrixId
<
6
;
matrixId
+=
(
sizeId
==
3
?
3
:
1
))
{
flag
(
scaling_list_pred_mode_flag
[
sizeId
][
matrixId
]);
flags
(
scaling_list_pred_mode_flag
[
sizeId
][
matrixId
],
2
,
sizeId
,
matrixId
);
if
(
!
current
->
scaling_list_pred_mode_flag
[
sizeId
][
matrixId
])
{
if
(
!
current
->
scaling_list_pred_mode_flag
[
sizeId
][
matrixId
])
{
ue
(
scaling_list_pred_matrix_id_delta
[
sizeId
][
matrixId
],
ues
(
scaling_list_pred_matrix_id_delta
[
sizeId
][
matrixId
],
0
,
sizeId
==
3
?
matrixId
/
3
:
matrixId
);
0
,
sizeId
==
3
?
matrixId
/
3
:
matrixId
,
2
,
sizeId
,
matrixId
);
}
else
{
}
else
{
n
=
FFMIN
(
64
,
1
<<
(
4
+
(
sizeId
<<
1
)));
n
=
FFMIN
(
64
,
1
<<
(
4
+
(
sizeId
<<
1
)));
if
(
sizeId
>
1
)
if
(
sizeId
>
1
)
{
se
(
scaling_list_dc_coef_minus8
[
sizeId
-
2
][
matrixId
],
-
7
,
+
247
);
ses
(
scaling_list_dc_coef_minus8
[
sizeId
-
2
][
matrixId
],
-
7
,
+
247
,
2
,
sizeId
-
2
,
matrixId
);
}
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
xse
(
scaling_list_delta_coeff
,
ses
(
scaling_list_delta_coeff
[
sizeId
][
matrixId
][
i
],
current
->
scaling_list_delta_coeff
[
sizeId
][
matrixId
][
i
],
-
128
,
+
127
,
3
,
sizeId
,
matrixId
,
i
);
-
128
,
+
127
);
}
}
}
}
}
}
...
@@ -658,8 +664,8 @@ static int FUNC(sps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -658,8 +664,8 @@ static int FUNC(sps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw,
int
bit_depth
=
comp
==
0
?
current
->
bit_depth_luma_minus8
+
8
int
bit_depth
=
comp
==
0
?
current
->
bit_depth_luma_minus8
+
8
:
current
->
bit_depth_chroma_minus8
+
8
;
:
current
->
bit_depth_chroma_minus8
+
8
;
for
(
i
=
0
;
i
<=
current
->
sps_num_palette_predictor_initializer_minus1
;
i
++
)
for
(
i
=
0
;
i
<=
current
->
sps_num_palette_predictor_initializer_minus1
;
i
++
)
u
(
bit_depth
,
sps_palette_predictor_initializers
[
comp
][
i
],
u
s
(
bit_depth
,
sps_palette_predictor_initializers
[
comp
][
i
],
0
,
MAX_UINT_BITS
(
bit_depth
)
);
0
,
MAX_UINT_BITS
(
bit_depth
),
2
,
comp
,
i
);
}
}
}
}
}
}
...
@@ -742,9 +748,12 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -742,9 +748,12 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
for
(
i
=
(
current
->
sps_sub_layer_ordering_info_present_flag
?
for
(
i
=
(
current
->
sps_sub_layer_ordering_info_present_flag
?
0
:
current
->
sps_max_sub_layers_minus1
);
0
:
current
->
sps_max_sub_layers_minus1
);
i
<=
current
->
sps_max_sub_layers_minus1
;
i
++
)
{
i
<=
current
->
sps_max_sub_layers_minus1
;
i
++
)
{
ue
(
sps_max_dec_pic_buffering_minus1
[
i
],
0
,
HEVC_MAX_DPB_SIZE
-
1
);
ues
(
sps_max_dec_pic_buffering_minus1
[
i
],
ue
(
sps_max_num_reorder_pics
[
i
],
0
,
current
->
sps_max_dec_pic_buffering_minus1
[
i
]);
0
,
HEVC_MAX_DPB_SIZE
-
1
,
1
,
i
);
ue
(
sps_max_latency_increase_plus1
[
i
],
0
,
UINT32_MAX
-
1
);
ues
(
sps_max_num_reorder_pics
[
i
],
0
,
current
->
sps_max_dec_pic_buffering_minus1
[
i
],
1
,
i
);
ues
(
sps_max_latency_increase_plus1
[
i
],
0
,
UINT32_MAX
-
1
,
1
,
i
);
}
}
if
(
!
current
->
sps_sub_layer_ordering_info_present_flag
)
{
if
(
!
current
->
sps_sub_layer_ordering_info_present_flag
)
{
for
(
i
=
0
;
i
<
current
->
sps_max_sub_layers_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<
current
->
sps_max_sub_layers_minus1
;
i
++
)
{
...
@@ -819,10 +828,10 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -819,10 +828,10 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
if
(
current
->
long_term_ref_pics_present_flag
)
{
if
(
current
->
long_term_ref_pics_present_flag
)
{
ue
(
num_long_term_ref_pics_sps
,
0
,
HEVC_MAX_LONG_TERM_REF_PICS
);
ue
(
num_long_term_ref_pics_sps
,
0
,
HEVC_MAX_LONG_TERM_REF_PICS
);
for
(
i
=
0
;
i
<
current
->
num_long_term_ref_pics_sps
;
i
++
)
{
for
(
i
=
0
;
i
<
current
->
num_long_term_ref_pics_sps
;
i
++
)
{
u
(
current
->
log2_max_pic_order_cnt_lsb_minus4
+
4
,
u
s
(
current
->
log2_max_pic_order_cnt_lsb_minus4
+
4
,
lt_ref_pic_poc_lsb_sps
[
i
],
lt_ref_pic_poc_lsb_sps
[
i
],
0
,
MAX_UINT_BITS
(
current
->
log2_max_pic_order_cnt_lsb_minus4
+
4
)
);
0
,
MAX_UINT_BITS
(
current
->
log2_max_pic_order_cnt_lsb_minus4
+
4
),
1
,
i
);
flag
(
used_by_curr_pic_lt_sps_flag
[
i
]
);
flag
s
(
used_by_curr_pic_lt_sps_flag
[
i
],
1
,
i
);
}
}
}
}
...
@@ -875,8 +884,8 @@ static int FUNC(pps_range_extension)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -875,8 +884,8 @@ static int FUNC(pps_range_extension)(CodedBitstreamContext *ctx, RWContext *rw,
0
,
sps
->
log2_diff_max_min_luma_coding_block_size
);
0
,
sps
->
log2_diff_max_min_luma_coding_block_size
);
ue
(
chroma_qp_offset_list_len_minus1
,
0
,
5
);
ue
(
chroma_qp_offset_list_len_minus1
,
0
,
5
);
for
(
i
=
0
;
i
<=
current
->
chroma_qp_offset_list_len_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<=
current
->
chroma_qp_offset_list_len_minus1
;
i
++
)
{
se
(
cb_qp_offset_list
[
i
],
-
12
,
+
12
);
se
s
(
cb_qp_offset_list
[
i
],
-
12
,
+
12
,
1
,
i
);
se
(
cr_qp_offset_list
[
i
],
-
12
,
+
12
);
se
s
(
cr_qp_offset_list
[
i
],
-
12
,
+
12
,
1
,
i
);
}
}
}
}
...
@@ -918,8 +927,8 @@ static int FUNC(pps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -918,8 +927,8 @@ static int FUNC(pps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw,
int
bit_depth
=
comp
==
0
?
current
->
luma_bit_depth_entry_minus8
+
8
int
bit_depth
=
comp
==
0
?
current
->
luma_bit_depth_entry_minus8
+
8
:
current
->
chroma_bit_depth_entry_minus8
+
8
;
:
current
->
chroma_bit_depth_entry_minus8
+
8
;
for
(
i
=
0
;
i
<
current
->
pps_num_palette_predictor_initializer
;
i
++
)
for
(
i
=
0
;
i
<
current
->
pps_num_palette_predictor_initializer
;
i
++
)
u
(
bit_depth
,
pps_palette_predictor_initializers
[
comp
][
i
],
u
s
(
bit_depth
,
pps_palette_predictor_initializers
[
comp
][
i
],
0
,
MAX_UINT_BITS
(
bit_depth
)
);
0
,
MAX_UINT_BITS
(
bit_depth
),
2
,
comp
,
i
);
}
}
}
}
}
}
...
@@ -985,9 +994,9 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -985,9 +994,9 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw,
flag
(
uniform_spacing_flag
);
flag
(
uniform_spacing_flag
);
if
(
!
current
->
uniform_spacing_flag
)
{
if
(
!
current
->
uniform_spacing_flag
)
{
for
(
i
=
0
;
i
<
current
->
num_tile_columns_minus1
;
i
++
)
for
(
i
=
0
;
i
<
current
->
num_tile_columns_minus1
;
i
++
)
ue
(
column_width_minus1
[
i
],
0
,
sps
->
pic_width_in_luma_samples
);
ue
s
(
column_width_minus1
[
i
],
0
,
sps
->
pic_width_in_luma_samples
,
1
,
i
);
for
(
i
=
0
;
i
<
current
->
num_tile_rows_minus1
;
i
++
)
for
(
i
=
0
;
i
<
current
->
num_tile_rows_minus1
;
i
++
)
ue
(
row_height_minus1
[
i
],
0
,
sps
->
pic_height_in_luma_samples
);
ue
s
(
row_height_minus1
[
i
],
0
,
sps
->
pic_height_in_luma_samples
,
1
,
i
);
}
}
flag
(
loop_filter_across_tiles_enabled_flag
);
flag
(
loop_filter_across_tiles_enabled_flag
);
}
else
{
}
else
{
...
@@ -1078,14 +1087,14 @@ static int FUNC(ref_pic_lists_modification)(CodedBitstreamContext *ctx, RWContex
...
@@ -1078,14 +1087,14 @@ static int FUNC(ref_pic_lists_modification)(CodedBitstreamContext *ctx, RWContex
flag
(
ref_pic_list_modification_flag_l0
);
flag
(
ref_pic_list_modification_flag_l0
);
if
(
current
->
ref_pic_list_modification_flag_l0
)
{
if
(
current
->
ref_pic_list_modification_flag_l0
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l0_active_minus1
;
i
++
)
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l0_active_minus1
;
i
++
)
u
(
entry_size
,
list_entry_l0
[
i
],
0
,
num_pic_total_curr
-
1
);
u
s
(
entry_size
,
list_entry_l0
[
i
],
0
,
num_pic_total_curr
-
1
,
1
,
i
);
}
}
if
(
current
->
slice_type
==
HEVC_SLICE_B
)
{
if
(
current
->
slice_type
==
HEVC_SLICE_B
)
{
flag
(
ref_pic_list_modification_flag_l1
);
flag
(
ref_pic_list_modification_flag_l1
);
if
(
current
->
ref_pic_list_modification_flag_l1
)
{
if
(
current
->
ref_pic_list_modification_flag_l1
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l1_active_minus1
;
i
++
)
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l1_active_minus1
;
i
++
)
u
(
entry_size
,
list_entry_l1
[
i
],
0
,
num_pic_total_curr
-
1
);
u
s
(
entry_size
,
list_entry_l1
[
i
],
0
,
num_pic_total_curr
-
1
,
1
,
i
);
}
}
}
}
...
@@ -1109,14 +1118,14 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -1109,14 +1118,14 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l0_active_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l0_active_minus1
;
i
++
)
{
if
(
1
/* is not same POC and same layer_id */
)
if
(
1
/* is not same POC and same layer_id */
)
flag
(
luma_weight_l0_flag
[
i
]
);
flag
s
(
luma_weight_l0_flag
[
i
],
1
,
i
);
else
else
infer
(
luma_weight_l0_flag
[
i
],
0
);
infer
(
luma_weight_l0_flag
[
i
],
0
);
}
}
if
(
chroma
)
{
if
(
chroma
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l0_active_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l0_active_minus1
;
i
++
)
{
if
(
1
/* is not same POC and same layer_id */
)
if
(
1
/* is not same POC and same layer_id */
)
flag
(
chroma_weight_l0_flag
[
i
]
);
flag
s
(
chroma_weight_l0_flag
[
i
],
1
,
i
);
else
else
infer
(
chroma_weight_l0_flag
[
i
],
0
);
infer
(
chroma_weight_l0_flag
[
i
],
0
);
}
}
...
@@ -1124,20 +1133,20 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -1124,20 +1133,20 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l0_active_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l0_active_minus1
;
i
++
)
{
if
(
current
->
luma_weight_l0_flag
[
i
])
{
if
(
current
->
luma_weight_l0_flag
[
i
])
{
se
(
delta_luma_weight_l0
[
i
],
-
128
,
+
127
);
se
s
(
delta_luma_weight_l0
[
i
],
-
128
,
+
127
,
1
,
i
);
se
(
luma_offset_l0
[
i
],
se
s
(
luma_offset_l0
[
i
],
-
(
1
<<
(
sps
->
bit_depth_luma_minus8
+
8
-
1
)),
-
(
1
<<
(
sps
->
bit_depth_luma_minus8
+
8
-
1
)),
((
1
<<
(
sps
->
bit_depth_luma_minus8
+
8
-
1
))
-
1
)
);
((
1
<<
(
sps
->
bit_depth_luma_minus8
+
8
-
1
))
-
1
),
1
,
i
);
}
else
{
}
else
{
infer
(
delta_luma_weight_l0
[
i
],
0
);
infer
(
delta_luma_weight_l0
[
i
],
0
);
infer
(
luma_offset_l0
[
i
],
0
);
infer
(
luma_offset_l0
[
i
],
0
);
}
}
if
(
current
->
chroma_weight_l0_flag
[
i
])
{
if
(
current
->
chroma_weight_l0_flag
[
i
])
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
se
(
delta_chroma_weight_l0
[
i
][
j
],
-
128
,
+
127
);
se
s
(
delta_chroma_weight_l0
[
i
][
j
],
-
128
,
+
127
,
2
,
i
,
j
);
se
(
chroma_offset_l0
[
i
][
j
],
se
s
(
chroma_offset_l0
[
i
][
j
],
-
(
4
<<
(
sps
->
bit_depth_chroma_minus8
+
8
-
1
)),
-
(
4
<<
(
sps
->
bit_depth_chroma_minus8
+
8
-
1
)),
((
4
<<
(
sps
->
bit_depth_chroma_minus8
+
8
-
1
))
-
1
)
);
((
4
<<
(
sps
->
bit_depth_chroma_minus8
+
8
-
1
))
-
1
),
2
,
i
,
j
);
}
}
}
else
{
}
else
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
...
@@ -1150,14 +1159,14 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -1150,14 +1159,14 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
if
(
current
->
slice_type
==
HEVC_SLICE_B
)
{
if
(
current
->
slice_type
==
HEVC_SLICE_B
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l1_active_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l1_active_minus1
;
i
++
)
{
if
(
1
/* RefPicList1[i] is not CurrPic, nor is it in a different layer */
)
if
(
1
/* RefPicList1[i] is not CurrPic, nor is it in a different layer */
)
flag
(
luma_weight_l1_flag
[
i
]
);
flag
s
(
luma_weight_l1_flag
[
i
],
1
,
i
);
else
else
infer
(
luma_weight_l1_flag
[
i
],
0
);
infer
(
luma_weight_l1_flag
[
i
],
0
);
}
}
if
(
chroma
)
{
if
(
chroma
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l1_active_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l1_active_minus1
;
i
++
)
{
if
(
1
/* RefPicList1[i] is not CurrPic, nor is it in a different layer */
)
if
(
1
/* RefPicList1[i] is not CurrPic, nor is it in a different layer */
)
flag
(
chroma_weight_l1_flag
[
i
]
);
flag
s
(
chroma_weight_l1_flag
[
i
],
1
,
i
);
else
else
infer
(
chroma_weight_l1_flag
[
i
],
0
);
infer
(
chroma_weight_l1_flag
[
i
],
0
);
}
}
...
@@ -1165,20 +1174,20 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -1165,20 +1174,20 @@ static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw,
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l1_active_minus1
;
i
++
)
{
for
(
i
=
0
;
i
<=
current
->
num_ref_idx_l1_active_minus1
;
i
++
)
{
if
(
current
->
luma_weight_l1_flag
[
i
])
{
if
(
current
->
luma_weight_l1_flag
[
i
])
{
se
(
delta_luma_weight_l1
[
i
],
-
128
,
+
127
);
se
s
(
delta_luma_weight_l1
[
i
],
-
128
,
+
127
,
1
,
i
);
se
(
luma_offset_l1
[
i
],
se
s
(
luma_offset_l1
[
i
],
-
(
1
<<
(
sps
->
bit_depth_luma_minus8
+
8
-
1
)),
-
(
1
<<
(
sps
->
bit_depth_luma_minus8
+
8
-
1
)),
((
1
<<
(
sps
->
bit_depth_luma_minus8
+
8
-
1
))
-
1
)
);
((
1
<<
(
sps
->
bit_depth_luma_minus8
+
8
-
1
))
-
1
),
1
,
i
);
}
else
{
}
else
{
infer
(
delta_luma_weight_l1
[
i
],
0
);
infer
(
delta_luma_weight_l1
[
i
],
0
);
infer
(
luma_offset_l1
[
i
],
0
);
infer
(
luma_offset_l1
[
i
],
0
);
}
}
if
(
current
->
chroma_weight_l1_flag
[
i
])
{
if
(
current
->
chroma_weight_l1_flag
[
i
])
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
se
(
delta_chroma_weight_l1
[
i
][
j
],
-
128
,
+
127
);
se
s
(
delta_chroma_weight_l1
[
i
][
j
],
-
128
,
+
127
,
2
,
i
,
j
);
se
(
chroma_offset_l1
[
i
][
j
],
se
s
(
chroma_offset_l1
[
i
][
j
],
-
(
4
<<
(
sps
->
bit_depth_chroma_minus8
+
8
-
1
)),
-
(
4
<<
(
sps
->
bit_depth_chroma_minus8
+
8
-
1
)),
((
4
<<
(
sps
->
bit_depth_chroma_minus8
+
8
-
1
))
-
1
)
);
((
4
<<
(
sps
->
bit_depth_chroma_minus8
+
8
-
1
))
-
1
),
2
,
i
,
j
);
}
}
}
else
{
}
else
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
...
@@ -1253,7 +1262,7 @@ static int FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -1253,7 +1262,7 @@ static int FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
if
(
!
current
->
dependent_slice_segment_flag
)
{
if
(
!
current
->
dependent_slice_segment_flag
)
{
for
(
i
=
0
;
i
<
pps
->
num_extra_slice_header_bits
;
i
++
)
for
(
i
=
0
;
i
<
pps
->
num_extra_slice_header_bits
;
i
++
)
flag
(
slice_reserved_flag
[
i
]
);
flag
s
(
slice_reserved_flag
[
i
],
1
,
i
);
ue
(
slice_type
,
0
,
2
);
ue
(
slice_type
,
0
,
2
);
...
@@ -1309,20 +1318,20 @@ static int FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -1309,20 +1318,20 @@ static int FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
current
->
num_long_term_pics
;
i
++
)
{
current
->
num_long_term_pics
;
i
++
)
{
if
(
i
<
current
->
num_long_term_sps
)
{
if
(
i
<
current
->
num_long_term_sps
)
{
if
(
sps
->
num_long_term_ref_pics_sps
>
1
)
if
(
sps
->
num_long_term_ref_pics_sps
>
1
)
u
(
idx_size
,
lt_idx_sps
[
i
],
u
s
(
idx_size
,
lt_idx_sps
[
i
],
0
,
sps
->
num_long_term_ref_pics_sps
-
1
);
0
,
sps
->
num_long_term_ref_pics_sps
-
1
,
1
,
i
);
if
(
sps
->
used_by_curr_pic_lt_sps_flag
[
current
->
lt_idx_sps
[
i
]])
if
(
sps
->
used_by_curr_pic_lt_sps_flag
[
current
->
lt_idx_sps
[
i
]])
++
num_pic_total_curr
;
++
num_pic_total_curr
;
}
else
{
}
else
{
u
(
sps
->
log2_max_pic_order_cnt_lsb_minus4
+
4
,
poc_lsb_lt
[
i
],
u
s
(
sps
->
log2_max_pic_order_cnt_lsb_minus4
+
4
,
poc_lsb_lt
[
i
],
0
,
MAX_UINT_BITS
(
sps
->
log2_max_pic_order_cnt_lsb_minus4
+
4
)
);
0
,
MAX_UINT_BITS
(
sps
->
log2_max_pic_order_cnt_lsb_minus4
+
4
),
1
,
i
);
flag
(
used_by_curr_pic_lt_flag
[
i
]
);
flag
s
(
used_by_curr_pic_lt_flag
[
i
],
1
,
i
);
if
(
current
->
used_by_curr_pic_lt_flag
[
i
])
if
(
current
->
used_by_curr_pic_lt_flag
[
i
])
++
num_pic_total_curr
;
++
num_pic_total_curr
;
}
}
flag
(
delta_poc_msb_present_flag
[
i
]
);
flag
s
(
delta_poc_msb_present_flag
[
i
],
1
,
i
);
if
(
current
->
delta_poc_msb_present_flag
[
i
])
if
(
current
->
delta_poc_msb_present_flag
[
i
])
ue
(
delta_poc_msb_cycle_lt
[
i
],
0
,
UINT32_MAX
-
1
);
ue
s
(
delta_poc_msb_cycle_lt
[
i
],
0
,
UINT32_MAX
-
1
,
1
,
i
);
else
else
infer
(
delta_poc_msb_cycle_lt
[
i
],
0
);
infer
(
delta_poc_msb_cycle_lt
[
i
],
0
);
}
}
...
@@ -1480,15 +1489,15 @@ static int FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -1480,15 +1489,15 @@ static int FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
if
(
current
->
num_entry_point_offsets
>
0
)
{
if
(
current
->
num_entry_point_offsets
>
0
)
{
ue
(
offset_len_minus1
,
0
,
31
);
ue
(
offset_len_minus1
,
0
,
31
);
for
(
i
=
0
;
i
<
current
->
num_entry_point_offsets
;
i
++
)
for
(
i
=
0
;
i
<
current
->
num_entry_point_offsets
;
i
++
)
u
(
current
->
offset_len_minus1
+
1
,
entry_point_offset_minus1
[
i
],
u
s
(
current
->
offset_len_minus1
+
1
,
entry_point_offset_minus1
[
i
],
0
,
MAX_UINT_BITS
(
current
->
offset_len_minus1
+
1
)
);
0
,
MAX_UINT_BITS
(
current
->
offset_len_minus1
+
1
),
1
,
i
);
}
}
}
}
if
(
pps
->
slice_segment_header_extension_present_flag
)
{
if
(
pps
->
slice_segment_header_extension_present_flag
)
{
ue
(
slice_segment_header_extension_length
,
0
,
256
);
ue
(
slice_segment_header_extension_length
,
0
,
256
);
for
(
i
=
0
;
i
<
current
->
slice_segment_header_extension_length
;
i
++
)
for
(
i
=
0
;
i
<
current
->
slice_segment_header_extension_length
;
i
++
)
u
(
8
,
slice_segment_header_extension_data_byte
[
i
],
0x00
,
0xff
);
u
s
(
8
,
slice_segment_header_extension_data_byte
[
i
],
0x00
,
0xff
,
1
,
i
);
}
}
CHECK
(
FUNC
(
byte_alignment
)(
ctx
,
rw
));
CHECK
(
FUNC
(
byte_alignment
)(
ctx
,
rw
));
...
...
libavcodec/cbs_internal.h
View file @
300ef253
...
@@ -63,8 +63,8 @@ typedef struct CodedBitstreamType {
...
@@ -63,8 +63,8 @@ typedef struct CodedBitstreamType {
void
ff_cbs_trace_header
(
CodedBitstreamContext
*
ctx
,
void
ff_cbs_trace_header
(
CodedBitstreamContext
*
ctx
,
const
char
*
name
);
const
char
*
name
);
void
ff_cbs_trace_syntax_element
(
CodedBitstreamContext
*
ctx
,
void
ff_cbs_trace_syntax_element
(
CodedBitstreamContext
*
ctx
,
int
position
,
int
position
,
const
char
*
name
,
const
char
*
name
,
const
int
*
subscripts
,
const
char
*
bitstring
,
int64_t
value
);
const
char
*
bitstring
,
int64_t
value
);
...
@@ -72,11 +72,13 @@ void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx,
...
@@ -72,11 +72,13 @@ void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx,
// generation of trace output.
// generation of trace output.
int
ff_cbs_read_unsigned
(
CodedBitstreamContext
*
ctx
,
GetBitContext
*
gbc
,
int
ff_cbs_read_unsigned
(
CodedBitstreamContext
*
ctx
,
GetBitContext
*
gbc
,
int
width
,
const
char
*
name
,
uint32_t
*
write_to
,
int
width
,
const
char
*
name
,
const
int
*
subscripts
,
uint32_t
*
write_to
,
uint32_t
range_min
,
uint32_t
range_max
);
uint32_t
range_min
,
uint32_t
range_max
);
int
ff_cbs_write_unsigned
(
CodedBitstreamContext
*
ctx
,
PutBitContext
*
pbc
,
int
ff_cbs_write_unsigned
(
CodedBitstreamContext
*
ctx
,
PutBitContext
*
pbc
,
int
width
,
const
char
*
name
,
uint32_t
value
,
int
width
,
const
char
*
name
,
const
int
*
subscripts
,
uint32_t
value
,
uint32_t
range_min
,
uint32_t
range_max
);
uint32_t
range_min
,
uint32_t
range_max
);
// The largest value representable in N bits, suitable for use as
// The largest value representable in N bits, suitable for use as
...
...
libavcodec/cbs_mpeg2.c
View file @
300ef253
...
@@ -38,24 +38,29 @@
...
@@ -38,24 +38,29 @@
#define FUNC_MPEG2(rw, name) FUNC_NAME(rw, mpeg2, name)
#define FUNC_MPEG2(rw, name) FUNC_NAME(rw, mpeg2, name)
#define FUNC(name) FUNC_MPEG2(READWRITE, name)
#define FUNC(name) FUNC_MPEG2(READWRITE, name)
#define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
#define ui(width, name) \
xui(width, name, current->name, 0)
#define uis(width, name, subs, ...) \
xui(width, name, current->name, subs, __VA_ARGS__)
#define READ
#define READ
#define READWRITE read
#define READWRITE read
#define RWContext GetBitContext
#define RWContext GetBitContext
#define xui(width, name, var) do { \
#define xui(width, name, var
, subs, ...
) do { \
uint32_t value = 0; \
uint32_t value = 0; \
CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \
CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, 0, (1 << width) - 1)); \
&value, 0, (1 << width) - 1)); \
var = value; \
var = value; \
} while (0)
} while (0)
#define ui(width, name) \
xui(width, name, current->name)
#define marker_bit() do { \
#define marker_bit() do { \
av_unused uint32_t one; \
av_unused uint32_t one; \
CHECK(ff_cbs_read_unsigned(ctx, rw, 1, "marker_bit", &one, 1, 1)); \
CHECK(ff_cbs_read_unsigned(ctx, rw, 1, "marker_bit",
NULL,
&one, 1, 1)); \
} while (0)
} while (0)
#define nextbits(width, compare, var) \
#define nextbits(width, compare, var) \
...
@@ -68,7 +73,6 @@
...
@@ -68,7 +73,6 @@
#undef READWRITE
#undef READWRITE
#undef RWContext
#undef RWContext
#undef xui
#undef xui
#undef ui
#undef marker_bit
#undef marker_bit
#undef nextbits
#undef nextbits
...
@@ -77,16 +81,14 @@
...
@@ -77,16 +81,14 @@
#define READWRITE write
#define READWRITE write
#define RWContext PutBitContext
#define RWContext PutBitContext
#define xui(width, name, var) do { \
#define xui(width, name, var
, subs, ...
) do { \
CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \
CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
var, 0, (1 << width) - 1)); \
var, 0, (1 << width) - 1)); \
} while (0)
} while (0)
#define ui(width, name) \
xui(width, name, current->name)
#define marker_bit() do { \
#define marker_bit() do { \
CHECK(ff_cbs_write_unsigned(ctx, rw, 1, "marker_bit", 1, 1, 1)); \
CHECK(ff_cbs_write_unsigned(ctx, rw, 1, "marker_bit",
NULL,
1, 1, 1)); \
} while (0)
} while (0)
#define nextbits(width, compare, var) (var)
#define nextbits(width, compare, var) (var)
...
@@ -97,7 +99,6 @@
...
@@ -97,7 +99,6 @@
#undef READWRITE
#undef READWRITE
#undef RWContext
#undef RWContext
#undef xui
#undef xui
#undef ui
#undef marker_bit
#undef marker_bit
#undef nextbits
#undef nextbits
...
...
libavcodec/cbs_mpeg2_syntax_template.c
View file @
300ef253
...
@@ -44,13 +44,13 @@ static int FUNC(sequence_header)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -44,13 +44,13 @@ static int FUNC(sequence_header)(CodedBitstreamContext *ctx, RWContext *rw,
ui
(
1
,
load_intra_quantiser_matrix
);
ui
(
1
,
load_intra_quantiser_matrix
);
if
(
current
->
load_intra_quantiser_matrix
)
{
if
(
current
->
load_intra_quantiser_matrix
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
for
(
i
=
0
;
i
<
64
;
i
++
)
ui
(
8
,
intra_quantiser_matrix
[
i
]
);
ui
s
(
8
,
intra_quantiser_matrix
[
i
],
1
,
i
);
}
}
ui
(
1
,
load_non_intra_quantiser_matrix
);
ui
(
1
,
load_non_intra_quantiser_matrix
);
if
(
current
->
load_non_intra_quantiser_matrix
)
{
if
(
current
->
load_non_intra_quantiser_matrix
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
for
(
i
=
0
;
i
<
64
;
i
++
)
ui
(
8
,
non_intra_quantiser_matrix
[
i
]
);
ui
s
(
8
,
non_intra_quantiser_matrix
[
i
],
1
,
i
);
}
}
return
0
;
return
0
;
...
@@ -79,7 +79,7 @@ static int FUNC(user_data)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -79,7 +79,7 @@ static int FUNC(user_data)(CodedBitstreamContext *ctx, RWContext *rw,
#endif
#endif
for
(
k
=
0
;
k
<
current
->
user_data_length
;
k
++
)
for
(
k
=
0
;
k
<
current
->
user_data_length
;
k
++
)
xui
(
8
,
user_data
,
current
->
user_data
[
k
]);
xui
(
8
,
user_data
,
current
->
user_data
[
k
]
,
0
);
return
0
;
return
0
;
}
}
...
@@ -250,25 +250,25 @@ static int FUNC(quant_matrix_extension)(CodedBitstreamContext *ctx, RWContext *r
...
@@ -250,25 +250,25 @@ static int FUNC(quant_matrix_extension)(CodedBitstreamContext *ctx, RWContext *r
ui
(
1
,
load_intra_quantiser_matrix
);
ui
(
1
,
load_intra_quantiser_matrix
);
if
(
current
->
load_intra_quantiser_matrix
)
{
if
(
current
->
load_intra_quantiser_matrix
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
for
(
i
=
0
;
i
<
64
;
i
++
)
ui
(
8
,
intra_quantiser_matrix
[
i
]
);
ui
s
(
8
,
intra_quantiser_matrix
[
i
],
1
,
i
);
}
}
ui
(
1
,
load_non_intra_quantiser_matrix
);
ui
(
1
,
load_non_intra_quantiser_matrix
);
if
(
current
->
load_non_intra_quantiser_matrix
)
{
if
(
current
->
load_non_intra_quantiser_matrix
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
for
(
i
=
0
;
i
<
64
;
i
++
)
ui
(
8
,
non_intra_quantiser_matrix
[
i
]
);
ui
s
(
8
,
non_intra_quantiser_matrix
[
i
],
1
,
i
);
}
}
ui
(
1
,
load_chroma_intra_quantiser_matrix
);
ui
(
1
,
load_chroma_intra_quantiser_matrix
);
if
(
current
->
load_chroma_intra_quantiser_matrix
)
{
if
(
current
->
load_chroma_intra_quantiser_matrix
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
for
(
i
=
0
;
i
<
64
;
i
++
)
ui
(
8
,
intra_quantiser_matrix
[
i
]
);
ui
s
(
8
,
intra_quantiser_matrix
[
i
],
1
,
i
);
}
}
ui
(
1
,
load_chroma_non_intra_quantiser_matrix
);
ui
(
1
,
load_chroma_non_intra_quantiser_matrix
);
if
(
current
->
load_chroma_non_intra_quantiser_matrix
)
{
if
(
current
->
load_chroma_non_intra_quantiser_matrix
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
for
(
i
=
0
;
i
<
64
;
i
++
)
ui
(
8
,
chroma_non_intra_quantiser_matrix
[
i
]
);
ui
s
(
8
,
chroma_non_intra_quantiser_matrix
[
i
],
1
,
i
);
}
}
return
0
;
return
0
;
...
@@ -366,15 +366,16 @@ static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -366,15 +366,16 @@ static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw,
if
(
!
current
->
extra_information
)
if
(
!
current
->
extra_information
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
for
(
k
=
0
;
k
<
current
->
extra_information_length
;
k
++
)
{
for
(
k
=
0
;
k
<
current
->
extra_information_length
;
k
++
)
{
xui
(
1
,
extra_bit_slice
,
bit
);
xui
(
1
,
extra_bit_slice
,
bit
,
0
);
xui
(
8
,
extra_information_slice
,
xui
(
8
,
extra_information_slice
[
k
]
,
current
->
extra_information
[
k
]);
current
->
extra_information
[
k
]
,
1
,
k
);
}
}
}
}
#else
#else
for
(
k
=
0
;
k
<
current
->
extra_information_length
;
k
++
)
{
for
(
k
=
0
;
k
<
current
->
extra_information_length
;
k
++
)
{
xui
(
1
,
extra_bit_slice
,
1
);
xui
(
1
,
extra_bit_slice
,
1
,
0
);
xui
(
8
,
extra_information_slice
,
current
->
extra_information
[
k
]);
xui
(
8
,
extra_information_slice
[
k
],
current
->
extra_information
[
k
],
1
,
k
);
}
}
#endif
#endif
}
}
...
...
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