summaryrefslogtreecommitdiffstats
path: root/baseline/source/mpeg2
diff options
context:
space:
mode:
authorJoshua Bakita <bakitajoshua@gmail.com>2019-10-07 19:13:39 -0400
committerJoshua Bakita <bakitajoshua@gmail.com>2019-10-07 19:13:39 -0400
commit386b7d3366f1359a265da207a9cafa3edf553b64 (patch)
treec76120c2c138faed822e4ae386be6ef22a738a78 /baseline/source/mpeg2
parent54a3f7091a2146b29c73a6fdc4b62a5c4ad7a3d8 (diff)
Reorganize and commit all the modified TACLeBench code and run scripts
Diffstat (limited to 'baseline/source/mpeg2')
-rw-r--r--baseline/source/mpeg2/ChangeLog.txt35
-rw-r--r--baseline/source/mpeg2/mpeg2.c13218
2 files changed, 13253 insertions, 0 deletions
diff --git a/baseline/source/mpeg2/ChangeLog.txt b/baseline/source/mpeg2/ChangeLog.txt
new file mode 100644
index 0000000..f644576
--- /dev/null
+++ b/baseline/source/mpeg2/ChangeLog.txt
@@ -0,0 +1,35 @@
1File: mpeg2.c
2Original provenience: MediaBench II benchmark suite,
3 http://euler.slu.edu/~fritts/mediabench (mirror)
4
52015-11-05:
6- Removed original header comment, replaced by TACLeBench header.
7- Removed unnecessary preprocessor macros, integrated required preprocessor
8 macros directly in the source code.
9- Added prefix "mpeg2_" to all global symbols.
10- Added explicit forward declarations of functions.
11- Added TACLeBench-compliant initialization code.
12- Added new function mpeg2_return producing a checksum as return value.
13- Added new function mpeg2_main according to TACLeBench guidelines.
14 mpeg2_main is annotated as entry-point for timing analysis.
15- Applied code formatting according to the following rules
16 - Lines shall not be wider than 80 characters; whenever possible, appropriate
17 line breaks shall be inserted to keep lines below 80 characters
18 - Indentation is done using whitespaces only, no tabs. Code is indented by
19 two whitespaces
20 - Two empty lines are put between any two functions
21 - In non-empty lists or index expressions, opening '(' and '[' are followed by
22 one whitespace, closing ')' and ']' are preceded by one whitespace
23 - In comma- or colon-separated argument lists, one whitespace is put after
24 each comma/colon
25 - Names of functions and global variables all start with a benchmark-specific
26 prefix (here: bs_) followed by lowercase letter (e.g., bs_square)
27 - For pointer types, one whitespace is put before the '*'
28 - Operators within expressions shall be preceded and followed by one
29 whitespace
30 - Code of then- and else-parts of if-then-else statements shall be put in
31 separate lines, not in the same lines as the if-condition or the keyword
32 "else"
33 - Opening braces '{' denoting the beginning of code for some if-else or loop
34 body shall be put at the end of the same line where the keywords "if",
35 "else", "for", "while" etc. occur
diff --git a/baseline/source/mpeg2/mpeg2.c b/baseline/source/mpeg2/mpeg2.c
new file mode 100644
index 0000000..e89e1f9
--- /dev/null
+++ b/baseline/source/mpeg2/mpeg2.c
@@ -0,0 +1,13218 @@
1/*
2
3 This program is part of the TACLeBench benchmark suite.
4 Version V 2.0
5
6 Name: mpeg2
7
8 Author: MPEG Software Simulation Group
9
10 Function: This file contains MPEG 2 motion estimation code.
11
12 Source: MediaBench II
13 http://euler.slu.edu/~fritts/mediabench (mirror)
14
15 Original name: MPEG-2
16
17 Changes: For TACLeBench, the code has been changed such that input and
18 output arrays are scaled down so that the code plus its data fits to the
19 memories of typical resource-constrained embedded devices.
20
21 License: See the following disclaimer from the original source codes.
22
23 Disclaimer of Warranty
24
25 These software programs are available to the user without any license fee or
26 royalty on an "as is" basis. The MPEG Software Simulation Group disclaims
27 any and all warranties, whether express, implied, or statuary, including any
28 implied warranties or merchantability or of fitness for a particular
29 purpose. In no event shall the copyright-holder be liable for any
30 incidental, punitive, or consequential damages of any kind whatsoever
31 arising from the use of these programs.
32
33 This disclaimer of warranty extends to the user of these programs and user's
34 customers, employees, agents, transferees, successors, and assigns.
35
36 The MPEG Software Simulation Group does not represent or warrant that the
37 programs furnished hereunder are free of infringement of any third-party
38 patents.
39
40 Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,
41 are subject to royalty fees to patent holders. Many of these patents are
42 general enough such that they are unavoidable regardless of implementation
43 design.
44
45*/
46
47
48/*
49 Forward declaration of data types
50*/
51#include "../extra.h"
52struct mbinfo;
53
54
55/*
56 Forward declaration of functions
57*/
58
59void mpeg2_init( void );
60int mpeg2_return( void );
61void mpeg2_motion_estimation( unsigned char *, unsigned char *, unsigned char *,
62 unsigned char *, unsigned char *, unsigned char *,
63 int, int, int, int, struct mbinfo *, int, int );
64void mpeg2_frame_ME( unsigned char *, unsigned char *, unsigned char *,
65 unsigned char *, unsigned char *, int, int, int, int, int,
66 int, struct mbinfo * );
67void mpeg2_field_ME( unsigned char *, unsigned char *, unsigned char *,
68 unsigned char *, unsigned char *, unsigned char *, int,
69 int, int, int, int, int, struct mbinfo *, int, int );
70void mpeg2_frame_estimate( unsigned char *, unsigned char *, unsigned char *,
71 int, int, int, int, int *, int *, int *, int *,
72 int *, int *, int *, int *, int *, int *,
73 int[ 2 ][ 2 ], int[ 2 ][ 2 ] );
74void mpeg2_field_estimate( unsigned char *, unsigned char *, unsigned char *,
75 unsigned char *, unsigned char *, int, int, int, int,
76 int, int *, int *, int *, int *, int *, int *, int *,
77 int *, int *, int *, int *, int *, int *, int * );
78void mpeg2_dpframe_estimate( unsigned char *, unsigned char *, int, int,
79 int[ 2 ][ 2 ], int[ 2 ][ 2 ], int *, int *, int *,
80 int *, int *, int * );
81void mpeg2_dpfield_estimate( unsigned char *, unsigned char *, unsigned char *,
82 int, int, int, int, int *, int *, int *, int * );
83int mpeg2_fullsearch( unsigned char *, unsigned char *, unsigned char *, int,
84 int, int, int, int, int, int, int, int *, int * );
85int mpeg2_dist1( unsigned char *, unsigned char *, int, int, int, int, int );
86int mpeg2_dist2( unsigned char *, unsigned char *, int, int, int, int );
87int mpeg2_bdist1( unsigned char *, unsigned char *, unsigned char *, int, int,
88 int, int, int, int );
89int mpeg2_bdist2( unsigned char *, unsigned char *, unsigned char *, int, int,
90 int, int, int, int );
91int mpeg2_variance( unsigned char *, int );
92void mpeg2_main( void );
93//int main( void );
94
95
96/*
97 Declaration of global variables
98*/
99
100struct mbinfo {
101 int mb_type;
102 int motion_type;
103 int dct_type;
104 int mquant;
105 int cbp;
106 int skipped;
107 int MV[ 2 ][ 2 ][ 2 ];
108 int mv_field_sel[ 2 ][ 2 ];
109 int dmvector[ 2 ];
110 double act;
111 int var;
112};
113
114volatile int mpeg2_width = 352;
115volatile int mpeg2_height = 256;
116volatile int mpeg2_width2 = 352;
117volatile int mpeg2_height2 = 256;
118volatile int mpeg2_M = 3;
119volatile int mpeg2_pict_type = 3;
120volatile int mpeg2_pict_struct = 3;
121volatile int mpeg2_topfirst = 1;
122volatile int mpeg2_frame_pred_dct = 0;
123struct mbinfo mpeg2_mbinfo[ 352 ];
124
125unsigned char mpeg2_oldorgframe[] = {
126 0x9f, 0x9d, 0x9b, 0x9d, 0x9f, 0xa1, 0xa2, 0xa3,
127 0x9e, 0xa2, 0xa5, 0xa5, 0xa2, 0xa1, 0xa4, 0xa7,
128 0xa3, 0xa3, 0xa5, 0xa6, 0xa5, 0xa5, 0xa3, 0xa2,
129 0x9d, 0xa1, 0xa5, 0xa8, 0xa6, 0xa1, 0x9a, 0x95,
130 0x8e, 0x7e, 0x7a, 0x78, 0x70, 0x76, 0x7c, 0x73,
131 0x7d, 0x7a, 0x7a, 0x79, 0x7b, 0x83, 0x82, 0x74,
132 0x64, 0x57, 0x48, 0x5e, 0x7e, 0x84, 0x6f, 0x4a,
133 0x31, 0x43, 0x61, 0x81, 0x9b, 0xac, 0xb6, 0xb9,
134 0xb0, 0xa8, 0x9e, 0x9a, 0x9b, 0xa1, 0xaa, 0xb1,
135 0x9d, 0x83, 0x65, 0x49, 0x33, 0x30, 0x34, 0x32,
136 0x4b, 0x54, 0x68, 0x83, 0x99, 0x9f, 0x94, 0x87,
137 0x4f, 0x5e, 0x72, 0x7f, 0x75, 0x52, 0x23, 0x02,
138 0x1a, 0x24, 0x24, 0x1b, 0x14, 0x13, 0x1e, 0x30,
139 0x43, 0x60, 0x7b, 0x8a, 0x96, 0x9c, 0x97, 0x90,
140 0x99, 0x99, 0x92, 0x88, 0x7f, 0x80, 0x97, 0xb5,
141 0xa0, 0x94, 0x9a, 0x96, 0x66, 0x2d, 0x14, 0x12,
142 0x15, 0x17, 0x27, 0x1c, 0x15, 0x1e, 0x25, 0x3b,
143 0x7a, 0xa2, 0xbe, 0xbf, 0xb2, 0x9f, 0x9e, 0xaf,
144 0xba, 0x7b, 0x64, 0x8a, 0xa9, 0xa7, 0xa4, 0xaa,
145 0xa8, 0xab, 0xad, 0xab, 0xa7, 0xa6, 0xaa, 0xaf,
146 0xa4, 0xa6, 0xa9, 0xab, 0xac, 0xac, 0xaa, 0xa9,
147 0xa7, 0xaf, 0xba, 0xbc, 0xaf, 0x94, 0x75, 0x60,
148 0x7a, 0x85, 0x90, 0x9a, 0xa7, 0xa2, 0x7c, 0x50,
149 0x2f, 0x48, 0x65, 0x77, 0x7e, 0x8b, 0xa3, 0xb7,
150 0xae, 0x95, 0x7a, 0x6f, 0x75, 0x79, 0x73, 0x69,
151 0x56, 0x63, 0x6e, 0x6e, 0x6a, 0x6b, 0x72, 0x78,
152 0x65, 0x67, 0x61, 0x51, 0x3f, 0x36, 0x3b, 0x43,
153 0x33, 0x24, 0x25, 0x3d, 0x4d, 0x4b, 0x48, 0x4d,
154 0x57, 0x4b, 0x42, 0x47, 0x56, 0x62, 0x63, 0x5f,
155 0x60, 0x6d, 0x6f, 0x5b, 0x3f, 0x38, 0x4d, 0x67,