You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
huffyuvdec: trick for plane decoding, 8bits
10496 -> 9105 cycles. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
committed by
Michael Niedermayer
parent
35dae62204
commit
a37020402a
@@ -637,16 +637,12 @@ static void decode_422_bitstream(HYuvContext *s, int count)
|
|||||||
|
|
||||||
/* TODO instead of restarting the read when the code isn't in the first level
|
/* TODO instead of restarting the read when the code isn't in the first level
|
||||||
* of the joint table, jump into the 2nd level of the individual table. */
|
* of the joint table, jump into the 2nd level of the individual table. */
|
||||||
#define READ_2PIX_PLANE(dst0, dst1, plane){\
|
#define READ_2PIX_PLANE(dst0, dst1, plane) \
|
||||||
uint16_t code = get_vlc2(&s->gb, s->vlc[4+plane].table, VLC_BITS, 1);\
|
UPDATE_CACHE(re, &s->gb); \
|
||||||
if(code != 0xffff){\
|
GET_VLC_DUAL(dst0, dst1, re, &s->gb, s->vlc[4+plane].table, \
|
||||||
dst0 = code>>8;\
|
s->vlc[plane].table, s->vlc[plane].table, \
|
||||||
dst1 = code;\
|
VLC_BITS, 3, 0xffff)
|
||||||
}else{\
|
|
||||||
dst0 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3);\
|
|
||||||
dst1 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3);\
|
|
||||||
}\
|
|
||||||
}
|
|
||||||
#define READ_2PIX_PLANE14(dst0, dst1, plane){\
|
#define READ_2PIX_PLANE14(dst0, dst1, plane){\
|
||||||
int16_t code = get_vlc2(&s->gb, s->vlc[4+plane].table, VLC_BITS, 1);\
|
int16_t code = get_vlc2(&s->gb, s->vlc[4+plane].table, VLC_BITS, 1);\
|
||||||
if(code != (int16_t)0xffff){\
|
if(code != (int16_t)0xffff){\
|
||||||
@@ -671,6 +667,7 @@ static void decode_plane_bitstream(HYuvContext *s, int count, int plane)
|
|||||||
count/=2;
|
count/=2;
|
||||||
|
|
||||||
if (s->bps <= 8) {
|
if (s->bps <= 8) {
|
||||||
|
OPEN_READER(re, &s->gb);
|
||||||
if (count >= (get_bits_left(&s->gb)) / (31 * 2)) {
|
if (count >= (get_bits_left(&s->gb)) / (31 * 2)) {
|
||||||
for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
|
for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
|
||||||
READ_2PIX_PLANE(s->temp[0][2 * i], s->temp[0][2 * i + 1], plane);
|
READ_2PIX_PLANE(s->temp[0][2 * i], s->temp[0][2 * i + 1], plane);
|
||||||
@@ -680,6 +677,7 @@ static void decode_plane_bitstream(HYuvContext *s, int count, int plane)
|
|||||||
READ_2PIX_PLANE(s->temp[0][2 * i], s->temp[0][2 * i + 1], plane);
|
READ_2PIX_PLANE(s->temp[0][2 * i], s->temp[0][2 * i + 1], plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CLOSE_READER(re, &s->gb);
|
||||||
} else if (s->bps <= 14) {
|
} else if (s->bps <= 14) {
|
||||||
if (count >= (get_bits_left(&s->gb)) / (31 * 2)) {
|
if (count >= (get_bits_left(&s->gb)) / (31 * 2)) {
|
||||||
for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
|
for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
|
||||||
|
Reference in New Issue
Block a user