~ubuntu-branches/ubuntu/precise/libav/precise-updates

« back to all changes in this revision

Viewing changes to libavcodec/nuv.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:30:00 UTC
  • mfrom: (1.2.8) (1.1.13 experimental)
  • Revision ID: package-import@ubuntu.com-20120112223000-cmfo7w78q13i2fd9
Tags: 4:0.8~beta2-1ubuntu1
* Merge from debian, remaining changes:
  - don't build against libdirac, lame, libopenjpeg, librtmp, 
    x264, and xvid  (all in universe)

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
};
64
64
 
65
65
/**
66
 
 * \brief copy frame data from buffer to AVFrame, handling stride.
67
 
 * \param f destination AVFrame
68
 
 * \param src source buffer, does not use any line-stride
69
 
 * \param width width of the video frame
70
 
 * \param height height of the video frame
 
66
 * @brief copy frame data from buffer to AVFrame, handling stride.
 
67
 * @param f destination AVFrame
 
68
 * @param src source buffer, does not use any line-stride
 
69
 * @param width width of the video frame
 
70
 * @param height height of the video frame
71
71
 */
72
72
static void copy_frame(AVFrame *f, const uint8_t *src,
73
73
                       int width, int height) {
77
77
}
78
78
 
79
79
/**
80
 
 * \brief extract quantization tables from codec data into our context
 
80
 * @brief extract quantization tables from codec data into our context
81
81
 */
82
82
static int get_quant(AVCodecContext *avctx, NuvContext *c,
83
83
                     const uint8_t *buf, int size) {
94
94
}
95
95
 
96
96
/**
97
 
 * \brief set quantization tables from a quality value
 
97
 * @brief set quantization tables from a quality value
98
98
 */
99
99
static void get_quant_quality(NuvContext *c, int quality) {
100
100
    int i;
107
107
 
108
108
static int codec_reinit(AVCodecContext *avctx, int width, int height, int quality) {
109
109
    NuvContext *c = avctx->priv_data;
110
 
    width = (width + 1) & ~1;
111
 
    height = (height + 1) & ~1;
 
110
    width  = FFALIGN(width,  2);
 
111
    height = FFALIGN(height, 2);
112
112
    if (quality >= 0)
113
113
        get_quant_quality(c, quality);
114
114
    if (width != c->width || height != c->height) {
184
184
    }
185
185
    if (c->codec_frameheader) {
186
186
        int w, h, q;
187
 
        if (buf_size < 12) {
188
 
            av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame\n");
189
 
            return -1;
 
187
        if (buf[0] != 'V' || buf_size < 12) {
 
188
            av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame (wrong codec_tag?)\n");
 
189
            return AVERROR_INVALIDDATA;
190
190
        }
191
191
        w = AV_RL16(&buf[6]);
192
192
        h = AV_RL16(&buf[8]);
273
273
}
274
274
 
275
275
AVCodec ff_nuv_decoder = {
276
 
    "nuv",
277
 
    AVMEDIA_TYPE_VIDEO,
278
 
    CODEC_ID_NUV,
279
 
    sizeof(NuvContext),
280
 
    decode_init,
281
 
    NULL,
282
 
    decode_end,
283
 
    decode_frame,
284
 
    CODEC_CAP_DR1,
 
276
    .name           = "nuv",
 
277
    .type           = AVMEDIA_TYPE_VIDEO,
 
278
    .id             = CODEC_ID_NUV,
 
279
    .priv_data_size = sizeof(NuvContext),
 
280
    .init           = decode_init,
 
281
    .close          = decode_end,
 
282
    .decode         = decode_frame,
 
283
    .capabilities   = CODEC_CAP_DR1,
285
284
    .long_name = NULL_IF_CONFIG_SMALL("NuppelVideo/RTJPEG"),
286
285
};
287
286