1 /* { dg-do compile } */
2 /* { dg-options "-O1 -mtune=amdfam10 -fexpensive-optimizations -fgcse -foptimize-register-move -freorder-blocks -fschedule-insns2 -funswitch-loops -fgcse-las -fselective-scheduling2 -fsel-sched-pipelining -funroll-all-loops" } */
3
4 typedef char uint8_t;
5 typedef int uint32_t;
6 typedef int vo_frame_t;
7 __extension__ typedef __SIZE_TYPE__ size_t;
8
9 struct vo_frame_s
10 {
11 uint8_t base[3];
12 int pitches[3];};
13 typedef struct
14 {
15 void
16 (*proc_macro_block)
17 (void);
18 }
19 xine_xvmc_t;
20 typedef struct
21 {
22 uint8_t ref[2][3];
23 int pmv;
24 }
25 motion_t;
26 typedef struct
27 {
28 uint32_t bitstream_buf;
29 int bitstream_bits;
30 uint8_t * bitstream_ptr;
31 uint8_t dest[3];
32 int pitches[3];
33 int offset;
34 motion_t b_motion;
35 motion_t f_motion;
36 int v_offset;
37 int coded_picture_width;
38 int picture_structure;
39 struct vo_frame_s *current_frame;}
40 picture_t;
41 typedef struct
42 {
43 int xvmc_last_slice_code;}
44 mpeg2dec_accel_t;
bitstream_init(picture_t * picture,void * start)45 static int bitstream_init (picture_t * picture, void *start)
46 {
47 picture->bitstream_ptr = start;
48 return (int) (size_t) start;
49 }
slice_xvmc_init(picture_t * picture,int code)50 static void slice_xvmc_init (picture_t * picture, int code)
51 {
52 int offset;
53 struct vo_frame_s *forward_reference_frame;
54 offset = picture->picture_structure == 2;
55 picture->pitches[0] = picture->current_frame->pitches[0];
56 picture->pitches[1] = picture->current_frame->pitches[1];
57 if (picture)
58 picture->f_motion.ref
59 [0]
60 [0]
61 = (char) (size_t) (forward_reference_frame->base + (offset ? picture->pitches[0] : 0));
62 picture->f_motion.ref[0][1] = (offset);
63 if (picture->picture_structure)
64 picture->pitches[0] <<= picture->pitches[1] <<= 1;
65 offset = 0;
66 while (1)
67 {
68 if (picture->bitstream_buf >= 0x08000000)
69 break;
70 switch (picture->bitstream_buf >> 12)
71 {
72 case 8:
73 offset += 33;
74 picture->bitstream_buf
75 |=
76 picture->bitstream_ptr[1] << picture->bitstream_bits;
77 }
78 }
79 picture->offset = (offset);
80 while (picture->offset - picture->coded_picture_width >= 0)
81 {
82 picture->offset -= picture->coded_picture_width;
83 if (picture->current_frame)
84 {
85 picture->dest[0] += picture->pitches[0];
86 picture->dest[1] += picture->pitches[1];
87 }
88 picture->v_offset += 16;
89 }
90 }
91
92 void
mpeg2_xvmc_slice(mpeg2dec_accel_t * accel,picture_t * picture,int code,uint8_t buffer,int mba_inc)93 mpeg2_xvmc_slice
94 (mpeg2dec_accel_t * accel, picture_t * picture, int code, uint8_t buffer,int mba_inc)
95 {
96 xine_xvmc_t * xvmc = (xine_xvmc_t *) (size_t) bitstream_init (picture, (void *) (size_t) buffer);
97 slice_xvmc_init (picture, code);
98 while (1)
99 {
100 if (picture)
101 break;
102 switch (picture->bitstream_buf)
103 {
104 case 8:
105 mba_inc += accel->xvmc_last_slice_code = code;
106 xvmc->proc_macro_block ();
107 while (mba_inc)
108 ;
109 }
110 }
111 }
112