Revision c46eeae2

View differences:

libavcodec/ituh263enc.c
82 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 86
 * Returns the 4 bit value that specifies the given aspect ratio.
103 87
 * This may be one of the standard aspect ratios or it specifies
......
156 140
    put_bits(&s->pb, 1, 0);     /* camera  off */
157 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 144
    if (!s->h263_plus) {
161 145
        /* H.263v1 */
162 146
        put_bits(&s->pb, 3, format);
libavcodec/mpegvideo_enc.c
31 31
#include "dsputil.h"
32 32
#include "mpegvideo.h"
33 33
#include "mpegvideo_common.h"
34
#include "h263.h"
34 35
#include "mjpegenc.h"
35 36
#include "msmpeg4.h"
36 37
#include "faandct.h"
......
570 571
        break;
571 572
    case CODEC_ID_H263:
572 573
        if (!CONFIG_H263_ENCODER)  return -1;
573
        if (h263_get_picture_format(s->width, s->height) == 7) {
574
        if (ff_match_2uint16(h263_format, FF_ARRAY_ELEMS(h263_format), s->width, s->height) == 7) {
574 575
            av_log(avctx, AV_LOG_INFO, "The specified picture size of %dx%d is not valid for the H.263 codec.\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\n", s->width, s->height);
575 576
            return -1;
576 577
        }
libavcodec/svq1.c
37 37
#include "svq1_vlc.h"
38 38

  
39 39
/* standard video sizes */
40
const struct svq1_frame_size ff_svq1_frame_size_table[8] = {
40
const struct svq1_frame_size ff_svq1_frame_size_table[7] = {
41 41
  { 160, 120 }, { 128,  96 }, { 176, 144 }, { 352, 288 },
42
  { 704, 576 }, { 240, 180 }, { 320, 240 }, {  -1,  -1 }
42
  { 704, 576 }, { 240, 180 }, { 320, 240 }
43 43
};
libavcodec/svq1.h
43 43
#define SVQ1_BLOCK_INTRA        3
44 44

  
45 45
struct svq1_frame_size {
46
    int width;
47
    int height;
46
    uint16_t width;
47
    uint16_t height;
48 48
};
49 49

  
50 50
uint16_t ff_svq1_packet_checksum (const uint8_t *data, const int length,
......
59 59
extern const uint16_t ff_svq1_intra_mean_vlc[256][2];
60 60
extern const uint16_t ff_svq1_inter_mean_vlc[512][2];
61 61

  
62
extern const struct svq1_frame_size ff_svq1_frame_size_table[8];
62
extern const struct svq1_frame_size ff_svq1_frame_size_table[7];
63 63

  
64 64
#endif /* AVCODEC_SVQ1_H */
libavcodec/svq1enc.c
94 94
        /* output 5 unknown bits (2 + 2 + 1) */
95 95
        put_bits(&s->pb, 5, 2); /* 2 needed by quicktime decoder */
96 96

  
97
        for (i = 0; i < 7; i++)
98
        {
99
            if ((ff_svq1_frame_size_table[i].width == s->frame_width) &&
100
                (ff_svq1_frame_size_table[i].height == s->frame_height))
101
            {
102
                put_bits(&s->pb, 3, i);
103
                break;
104
            }
105
        }
97
        i= ff_match_2uint16(ff_svq1_frame_size_table, FF_ARRAY_ELEMS(ff_svq1_frame_size_table), s->frame_width, s->frame_height);
98
        put_bits(&s->pb, 3, i);
106 99

  
107 100
        if (i == 7)
108 101
        {
109
            put_bits(&s->pb, 3, 7);
110 102
                put_bits(&s->pb, 12, s->frame_width);
111 103
                put_bits(&s->pb, 12, s->frame_height);
112 104
        }
libavcodec/utils.c
1200 1200
        return 0;
1201 1201
}
1202 1202

  
1203
int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){
1204
    int i;
1205
    for(i=0; i<size && !(tab[i][0]==a && tab[i][1]==b); i++);
1206
    return i;
1207
}
1208

  
1203 1209
void av_log_missing_feature(void *avc, const char *feature, int want_sample)
1204 1210
{
1205 1211
    av_log(avc, AV_LOG_WARNING, "%s not implemented. Update your FFmpeg "

Also available in: Unified diff