diff options
Diffstat (limited to 'baseline/source/h264_dec')
| -rw-r--r-- | baseline/source/h264_dec/changeLog.txt | 41 | ||||
| -rw-r--r-- | baseline/source/h264_dec/copyright.txt | 32 | ||||
| -rw-r--r-- | baseline/source/h264_dec/h264_dec.c | 610 | ||||
| -rw-r--r-- | baseline/source/h264_dec/h264_dec.h | 29 | ||||
| -rw-r--r-- | baseline/source/h264_dec/h264_decinput.c | 801 |
5 files changed, 1513 insertions, 0 deletions
diff --git a/baseline/source/h264_dec/changeLog.txt b/baseline/source/h264_dec/changeLog.txt new file mode 100644 index 0000000..2d5d97f --- /dev/null +++ b/baseline/source/h264_dec/changeLog.txt | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | File: h264dec_ldecode_macroblock.c | ||
| 2 | Original provenience: | ||
| 3 | |||
| 4 | 2015-12-21: | ||
| 5 | - Filename changed to h264dec.c | ||
| 6 | - global.h renamed to h264dec.h | ||
| 7 | - Removed commented out includes | ||
| 8 | - Removed all obsolete typedefs, enums and structs. Only remaining ones are | ||
| 9 | struct img_par and | ||
| 10 | enum SliceType | ||
| 11 | - Renamed function decode_one_macroblock to h264dec_decode_one_macroblock | ||
| 12 | - Function h264dec_decode_one_macroblock changed to void (i.e., removed statement return 0;) | ||
| 13 | - Added functions h264dec_init, h264dec_return and main | ||
| 14 | - Added forward declarations of all functions before the declarations of global | ||
| 15 | variables | ||
| 16 | - Struct 'ImageParameters' renamed to 'h264dec_ImageParameters' | ||
| 17 | - Re-ordered functions to fit template-order | ||
| 18 | - Applied code formatting according to the following rules | ||
| 19 | (incomplete, to be discussed; I basically used astyle with the attached | ||
| 20 | options file): | ||
| 21 | - Lines shall not be wider than 80 characters; whenever possible, appropriate | ||
| 22 | line breaks shall be inserted to keep lines below 80 characters | ||
| 23 | - Indentation is done using whitespaces only, no tabs. Code is indented by | ||
| 24 | two whitespaces | ||
| 25 | - Two empty lines are put between any two functions | ||
| 26 | - In non-empty lists or index expressions, opening '(' and '[' are followed by | ||
| 27 | one whitespace, closing ')' and ']' are preceded by one whitespace | ||
| 28 | - In comma- or colon-separated argument lists, one whitespace is put after | ||
| 29 | each comma/colon | ||
| 30 | - Names of functions and global variables all start with a benchmark-specific | ||
| 31 | prefix (here: st_) followed by lowercase letter (e.g., st_square) | ||
| 32 | - For pointer types, one whitespace is put before the '*' | ||
| 33 | - Operators within expressions shall be preceded and followed by one | ||
| 34 | whitespace | ||
| 35 | - Code of then- and else-parts of if-then-else statements shall be put in | ||
| 36 | separate lines, not in the same lines as the if-condition or the keyword | ||
| 37 | "else" | ||
| 38 | - Opening braces '{' denoting the beginning of code for some if-else or loop | ||
| 39 | body shall be put at the end of the same line where the keywords "if", | ||
| 40 | "else", "for", "while" etc. occur | ||
| 41 | - Added general TACLeBench header to beginning of source code \ No newline at end of file | ||
diff --git a/baseline/source/h264_dec/copyright.txt b/baseline/source/h264_dec/copyright.txt new file mode 100644 index 0000000..fe3eece --- /dev/null +++ b/baseline/source/h264_dec/copyright.txt | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | /* | ||
| 2 | *********************************************************************** | ||
| 3 | * COPYRIGHT AND WARRANTY INFORMATION | ||
| 4 | * | ||
| 5 | * Copyright 2001, International Telecommunications Union, Geneva | ||
| 6 | * | ||
| 7 | * DISCLAIMER OF WARRANTY | ||
| 8 | * | ||
| 9 | * These software programs are available to the user without any | ||
| 10 | * license fee or royalty on an "as is" basis. The ITU disclaims | ||
| 11 | * any and all warranties, whether express, implied, or | ||
| 12 | * statutory, including any implied warranties of merchantability | ||
| 13 | * or of fitness for a particular purpose. In no event shall the | ||
| 14 | * contributor or the ITU be liable for any incidental, punitive, or | ||
| 15 | * consequential damages of any kind whatsoever arising from the | ||
| 16 | * use of these programs. | ||
| 17 | * | ||
| 18 | * This disclaimer of warranty extends to the user of these programs | ||
| 19 | * and user's customers, employees, agents, transferees, successors, | ||
| 20 | * and assigns. | ||
| 21 | * | ||
| 22 | * The ITU does not represent or warrant that the programs furnished | ||
| 23 | * hereunder are free of infringement of any third-party patents. | ||
| 24 | * Commercial implementations of ITU-T Recommendations, including | ||
| 25 | * shareware, may be subject to royalty fees to patent holders. | ||
| 26 | * Information regarding the ITU-T patent policy is available from | ||
| 27 | * the ITU Web site at http://www.itu.int. | ||
| 28 | * | ||
| 29 | * THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE ITU-T PATENT POLICY. | ||
| 30 | ************************************************************************ | ||
| 31 | */ | ||
| 32 | |||
diff --git a/baseline/source/h264_dec/h264_dec.c b/baseline/source/h264_dec/h264_dec.c new file mode 100644 index 0000000..76af705 --- /dev/null +++ b/baseline/source/h264_dec/h264_dec.c | |||
| @@ -0,0 +1,610 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 2.0 | ||
| 5 | |||
| 6 | Name: h264_dec_ldecode_macroblock.c | ||
| 7 | |||
| 8 | Author: Inge Lille-Langoy et al. | ||
| 9 | |||
| 10 | Function: H.264 decoder | ||
| 11 | |||
| 12 | Source: MediaBench II | ||
| 13 | http://euler.slu.edu/~fritts/mediabench (mirror) | ||
| 14 | |||
| 15 | Original name: h264_dec_ldecode_macroblock.c | ||
| 16 | |||
| 17 | Changes: no functional changes | ||
| 18 | |||
| 19 | License: see copyright.txt | ||
| 20 | |||
| 21 | */ | ||
| 22 | |||
| 23 | |||
| 24 | /* | ||
| 25 | Include section | ||
| 26 | */ | ||
| 27 | |||
| 28 | #include "../extra.h" | ||
| 29 | #include "h264_dec.h" | ||
| 30 | |||
| 31 | |||
| 32 | /* | ||
| 33 | Forward declaration of functions | ||
| 34 | */ | ||
| 35 | |||
| 36 | void h264_dec_init (); | ||
| 37 | int h264_dec_return (); | ||
| 38 | void h264_dec_decode_one_macroblock( struct h264_dec_img_par *img ); | ||
| 39 | void h264_dec_main( void ); | ||
| 40 | //int main( void ); | ||
| 41 | |||
| 42 | |||
| 43 | /* | ||
| 44 | Declaration of global variables | ||
| 45 | */ | ||
| 46 | |||
| 47 | extern signed char h264_dec_mv_array[65][65][2]; | ||
| 48 | extern short h264_dec_list_imgUV[2][45][45]; | ||
| 49 | extern int h264_dec_img_m7[16][16]; | ||
| 50 | |||
| 51 | char h264_dec_img_mpr[7][7]; | ||
| 52 | char h264_dec_dec_picture_imgUV[2][64][54]; | ||
| 53 | struct h264_dec_img_par h264_dec_img; | ||
| 54 | |||
| 55 | |||
| 56 | /* | ||
| 57 | Initialization- and return-value-related functions | ||
| 58 | */ | ||
| 59 | |||
| 60 | int h264_dec_return () | ||
| 61 | { | ||
| 62 | return ( h264_dec_img_mpr[0][0] + h264_dec_dec_picture_imgUV[0][0][0] + 128 != | ||
| 63 | 0 ); | ||
| 64 | } | ||
| 65 | |||
| 66 | void h264_dec_init () | ||
| 67 | { | ||
| 68 | unsigned int i; | ||
| 69 | unsigned char *p; | ||
| 70 | volatile char bitmask = 0; | ||
| 71 | |||
| 72 | /* | ||
| 73 | Apply volatile XOR-bitmask to entire input array. | ||
| 74 | */ | ||
| 75 | p = ( unsigned char * ) &h264_dec_mv_array[ 0 ]; | ||
| 76 | _Pragma( "loopbound min 33800 max 33800" ) | ||
| 77 | for ( i = 0; i < sizeof( h264_dec_mv_array ); ++i, ++p ) | ||
| 78 | *p ^= bitmask; | ||
| 79 | |||
| 80 | p = ( unsigned char * ) &h264_dec_list_imgUV[ 0 ]; | ||
| 81 | _Pragma( "loopbound min 16200 max 16200" ) | ||
| 82 | for ( i = 0; i < sizeof( h264_dec_list_imgUV ); ++i, ++p ) | ||
| 83 | *p ^= bitmask; | ||
| 84 | |||
| 85 | p = ( unsigned char * ) &h264_dec_img_m7[ 0 ]; | ||
| 86 | _Pragma( "loopbound min 1024 max 1024" ) | ||
| 87 | for ( i = 0; i < sizeof( h264_dec_img_m7 ); ++i, ++p ) | ||
| 88 | *p ^= bitmask; | ||
| 89 | |||
| 90 | h264_dec_img.mb_cr_size_x = 8; | ||
| 91 | h264_dec_img.mb_cr_size_y = 8; | ||
| 92 | h264_dec_img.num_blk8x8_uv = 2; | ||
| 93 | h264_dec_img.pix_c_x = 256; | ||
| 94 | h264_dec_img.pix_c_y = 256; | ||
| 95 | h264_dec_img.width_cr = 352; | ||
| 96 | h264_dec_img.apply_weights = 0; | ||
| 97 | h264_dec_img.direct_spatial_mv_pred_flag = 1; | ||
| 98 | h264_dec_img.type = 1; | ||
| 99 | h264_dec_img.wp_round_chroma = 0; | ||
| 100 | h264_dec_img.chroma_log2_weight_denom = 0; | ||
| 101 | } | ||
| 102 | |||
| 103 | |||
| 104 | /* | ||
| 105 | Algorithm core functions | ||
| 106 | */ | ||
| 107 | |||
| 108 | void h264_dec_decode_one_macroblock( struct h264_dec_img_par *img ) | ||
| 109 | { | ||
| 110 | int i = 0, j = 0, ii = 0, jj = 0, i1 = 0, j1 = 0, j4 = 0, i4 = 0; | ||
| 111 | int uv; | ||
| 112 | int ioff, joff; | ||
| 113 | int bw_pred = 0, fw_pred = 0, ifx; | ||
| 114 | int ii0, jj0, ii1, jj1, if1, jf1, if0, jf0; | ||
| 115 | int f1_x, f1_y, f2_x, f2_y, f3, f4; | ||
| 116 | |||
| 117 | short fw_refframe = -1, bw_refframe = -1; | ||
| 118 | int mv_mode, pred_dir, intra_prediction; // = currMB->ref_frame; | ||
| 119 | short fw_ref_idx = -1, bw_ref_idx = -1; | ||
