2 /* { dg-do compile } */
3 /* { dg-require-effective-target ilp32 } */
4 /* { dg-options "-O" } */
6 typedef struct _fame_syntax_t_
{
9 typedef struct _fame_bitbuffer_t_
16 #define fast_bitbuffer_write(data, shift, c, l) \
20 asm("add %1, %%ecx\n" /* ecx = shift + length */ \
21 "shrd %%cl, %2, %3\n" /* adjust code to fit in */ \
22 "shr %%cl, %2\n" /* adjust code to fit in */ \
23 "mov %%ecx, %1\n" /* shift += length */ \
24 "bswap %2\n" /* reverse byte order of code */ \
25 "shr $5, %%ecx\n" /* get dword increment */ \
26 "or %2, (%0)\n" /* put first 32 bits */ \
27 "bswap %3\n" /* reverse byte order of code */ \
28 "lea (%0, %%ecx, 4), %0\n" /* data += (ecx>32) */ \
29 "andl $31, %1\n" /* mask shift */ \
30 "orl %3, (%0)\n" /* put last 32 bits */ \
31 : "=r"(data), "=r"(shift), "=a"(d), "=d"(d), "=c"(d) \
32 : "0"(data), "1"(shift), "2"((unsigned long) c), "3"(0), \
33 "c"((unsigned long) l) \
37 #define bitbuffer_write(bb, c, l) \
38 fast_bitbuffer_write((bb)->data, (bb)->shift, c, l)
40 typedef enum { frame_type_I
, frame_type_P
} frame_type_t
;
42 typedef struct _fame_syntax_mpeg1_t_
{
43 fame_bitbuffer_t buffer
;
44 frame_type_t frame_type
;
45 } fame_syntax_mpeg1_t
;
47 #define FAME_SYNTAX_MPEG1(x) ((fame_syntax_mpeg1_t *) x)
49 void mpeg1_start_picture(fame_syntax_t
*syntax
)
51 fame_syntax_mpeg1_t
*syntax_mpeg1
= FAME_SYNTAX_MPEG1(syntax
);
52 bitbuffer_write(&syntax_mpeg1
->buffer
, 0xFFFF, 16);
54 switch(syntax_mpeg1
->frame_type
) {
56 bitbuffer_write(&syntax_mpeg1
->buffer
, 0, 1);
59 bitbuffer_write(&syntax_mpeg1
->buffer
, 0, 1);