summaryrefslogtreecommitdiff
path: root/libavcodec/svq1enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-01-09 18:33:21 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-01-09 18:33:21 +0000
commitc46eeae2a80dfe0046c15b542e8b9a2c78f19bf7 (patch)
tree8c0378f0ae122dd5fcd3b101f7b55d0d233188f2 /libavcodec/svq1enc.c
parentaa11ce6568a190b7c843c57bcbc8f5e1785af99b (diff)
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. Originally committed as revision 21113 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/svq1enc.c')
-rw-r--r--libavcodec/svq1enc.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index 1c5ac5dfe2..ebe39c6c14 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -94,19 +94,11 @@ static void svq1_write_header(SVQ1Context *s, int frame_type)
/* output 5 unknown bits (2 + 2 + 1) */
put_bits(&s->pb, 5, 2); /* 2 needed by quicktime decoder */
- for (i = 0; i < 7; i++)
- {
- if ((ff_svq1_frame_size_table[i].width == s->frame_width) &&
- (ff_svq1_frame_size_table[i].height == s->frame_height))
- {
- put_bits(&s->pb, 3, i);
- break;
- }
- }
+ i= ff_match_2uint16(ff_svq1_frame_size_table, FF_ARRAY_ELEMS(ff_svq1_frame_size_table), s->frame_width, s->frame_height);
+ put_bits(&s->pb, 3, i);
if (i == 7)
{
- put_bits(&s->pb, 3, 7);
put_bits(&s->pb, 12, s->frame_width);
put_bits(&s->pb, 12, s->frame_height);
}