comparison ituh263enc.c @ 10832:f20726a6d538 libavcodec

Add a function to match a 2 element vector of uint16_t and use it in h263 and svq1 instead of custom and bloated code to find an index into a w/h array.
author michael
date Sat, 09 Jan 2010 18:33:21 +0000
parents d0657e337f91
children f6afc7837f83
comparison
equal deleted inserted replaced
10831:94982978af3b 10832:f20726a6d538
80 6, 39, 7, 38, 16, 37, 15, 10, 80 6, 39, 7, 38, 16, 37, 15, 10,
81 11, 12, 13, 14, 1, 21, 20, 18, 81 11, 12, 13, 14, 1, 21, 20, 18,
82 19, 2, 1, 34, 35, 36 82 19, 2, 1, 34, 35, 36
83 }; 83 };
84 84
85 int h263_get_picture_format(int width, int height)
86 {
87 if (width == 128 && height == 96)
88 return 1;
89 else if (width == 176 && height == 144)
90 return 2;
91 else if (width == 352 && height == 288)
92 return 3;
93 else if (width == 704 && height == 576)
94 return 4;
95 else if (width == 1408 && height == 1152)
96 return 5;
97 else
98 return 7;
99 }
100
101 /** 85 /**
102 * Returns the 4 bit value that specifies the given aspect ratio. 86 * Returns the 4 bit value that specifies the given aspect ratio.
103 * This may be one of the standard aspect ratios or it specifies 87 * This may be one of the standard aspect ratios or it specifies
104 * that the aspect will be stored explicitly later. 88 * that the aspect will be stored explicitly later.
105 */ 89 */
154 put_bits(&s->pb, 1, 0); /* h263 id */ 138 put_bits(&s->pb, 1, 0); /* h263 id */
155 put_bits(&s->pb, 1, 0); /* split screen off */ 139 put_bits(&s->pb, 1, 0); /* split screen off */
156 put_bits(&s->pb, 1, 0); /* camera off */ 140 put_bits(&s->pb, 1, 0); /* camera off */
157 put_bits(&s->pb, 1, 0); /* freeze picture release off */ 141 put_bits(&s->pb, 1, 0); /* freeze picture release off */
158 142
159 format = h263_get_picture_format(s->width, s->height); 143 format = ff_match_2uint16(h263_format, FF_ARRAY_ELEMS(h263_format), s->width, s->height);
160 if (!s->h263_plus) { 144 if (!s->h263_plus) {
161 /* H.263v1 */ 145 /* H.263v1 */
162 put_bits(&s->pb, 3, format); 146 put_bits(&s->pb, 3, format);
163 put_bits(&s->pb, 1, (s->pict_type == FF_P_TYPE)); 147 put_bits(&s->pb, 1, (s->pict_type == FF_P_TYPE));
164 /* By now UMV IS DISABLED ON H.263v1, since the restrictions 148 /* By now UMV IS DISABLED ON H.263v1, since the restrictions