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
e4ea84e1
Commit
e4ea84e1
authored
Feb 12, 2015
by
zhaoxiu.zeng
Committed by
Michael Niedermayer
Feb 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/wmv2: simplify cbp_table_index calculation
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
b4b9a64b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
20 deletions
+13
-20
wmv2.h
libavcodec/wmv2.h
+11
-0
wmv2dec.c
libavcodec/wmv2dec.c
+1
-10
wmv2enc.c
libavcodec/wmv2enc.c
+1
-10
No files found.
libavcodec/wmv2.h
View file @
e4ea84e1
...
...
@@ -56,4 +56,15 @@ typedef struct Wmv2Context {
void
ff_wmv2_common_init
(
Wmv2Context
*
w
);
static
av_always_inline
int
wmv2_get_cbp_table_index
(
MpegEncContext
*
s
,
int
cbp_index
)
{
static
const
uint8_t
map
[
3
][
3
]
=
{
{
0
,
2
,
1
},
{
1
,
0
,
2
},
{
2
,
1
,
0
},
};
return
map
[(
s
->
qscale
>
10
)
+
(
s
->
qscale
>
20
)][
cbp_index
];
}
#endif
/* AVCODEC_WMV2_H */
libavcodec/wmv2dec.c
View file @
e4ea84e1
...
...
@@ -173,16 +173,7 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
parse_mb_skip
(
w
);
cbp_index
=
decode012
(
&
s
->
gb
);
if
(
s
->
qscale
<=
10
)
{
int
map
[
3
]
=
{
0
,
2
,
1
};
w
->
cbp_table_index
=
map
[
cbp_index
];
}
else
if
(
s
->
qscale
<=
20
)
{
int
map
[
3
]
=
{
1
,
0
,
2
};
w
->
cbp_table_index
=
map
[
cbp_index
];
}
else
{
int
map
[
3
]
=
{
2
,
1
,
0
};
w
->
cbp_table_index
=
map
[
cbp_index
];
}
w
->
cbp_table_index
=
wmv2_get_cbp_table_index
(
s
,
cbp_index
);
if
(
w
->
mspel_bit
)
s
->
mspel
=
get_bits1
(
&
s
->
gb
);
...
...
libavcodec/wmv2enc.c
View file @
e4ea84e1
...
...
@@ -111,16 +111,7 @@ int ff_wmv2_encode_picture_header(MpegEncContext *s, int picture_number)
put_bits
(
&
s
->
pb
,
2
,
SKIP_TYPE_NONE
);
ff_msmpeg4_code012
(
&
s
->
pb
,
cbp_index
=
0
);
if
(
s
->
qscale
<=
10
)
{
int
map
[
3
]
=
{
0
,
2
,
1
};
w
->
cbp_table_index
=
map
[
cbp_index
];
}
else
if
(
s
->
qscale
<=
20
)
{
int
map
[
3
]
=
{
1
,
0
,
2
};
w
->
cbp_table_index
=
map
[
cbp_index
];
}
else
{
int
map
[
3
]
=
{
2
,
1
,
0
};
w
->
cbp_table_index
=
map
[
cbp_index
];
}
w
->
cbp_table_index
=
wmv2_get_cbp_table_index
(
s
,
cbp_index
);
if
(
w
->
mspel_bit
)
put_bits
(
&
s
->
pb
,
1
,
s
->
mspel
);
...
...
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