2 /* { dg-do compile { target i?86-*-* } } */
3 /* { dg-options "-O" } */
5 typedef struct _fame_syntax_t_
{
8 typedef struct _fame_bitbuffer_t_
15 #define fast_bitbuffer_write(data, shift, c, l) \
19 asm("add %1, %%ecx\n" /* ecx = shift + length */ \
20 "shrd %%cl, %2, %3\n" /* adjust code to fit in */ \
21 "shr %%cl, %2\n" /* adjust code to fit in */ \
22 "mov %%ecx, %1\n" /* shift += length */ \
23 "bswap %2\n" /* reverse byte order of code */ \
24 "shr $5, %%ecx\n" /* get dword increment */ \
25 "or %2, (%0)\n" /* put first 32 bits */ \
26 "bswap %3\n" /* reverse byte order of code */ \
27 "lea (%0, %%ecx, 4), %0\n" /* data += (ecx>32) */ \
28 "andl $31, %1\n" /* mask shift */ \
29 "orl %3, (%0)\n" /* put last 32 bits */ \
30 : "=r"(data), "=r"(shift), "=a"(d), "=d"(d), "=c"(d) \
31 : "0"(data), "1"(shift), "2"((unsigned long) c), "3"(0), \
32 "c"((unsigned long) l) \
36 #define bitbuffer_write(bb, c, l) \
37 fast_bitbuffer_write((bb)->data, (bb)->shift, c, l)
39 typedef enum { frame_type_I
, frame_type_P
} frame_type_t
;
41 typedef struct _fame_syntax_mpeg1_t_
{
42 fame_bitbuffer_t buffer
;
43 frame_type_t frame_type
;
44 } fame_syntax_mpeg1_t
;
46 #define FAME_SYNTAX_MPEG1(x) ((fame_syntax_mpeg1_t *) x)
48 void mpeg1_start_picture(fame_syntax_t
*syntax
)
50 fame_syntax_mpeg1_t
*syntax_mpeg1
= FAME_SYNTAX_MPEG1(syntax
);
51 bitbuffer_write(&syntax_mpeg1
->buffer
, 0xFFFF, 16);
53 switch(syntax_mpeg1
->frame_type
) {
55 bitbuffer_write(&syntax_mpeg1
->buffer
, 0, 1);
58 bitbuffer_write(&syntax_mpeg1
->buffer
, 0, 1);