Revision b482e2d1

View differences:

libavcodec/Makefile
32 32
ifeq ($(CONFIG_AVS_DECODER),yes)
33 33
    OBJS+= avs.o
34 34
endif
35
ifeq ($(CONFIG_CAVS_DECODER),yes)
36
    OBJS+= cavs.o cavsdsp.o
37
endif
35 38
ifeq ($(CONFIG_CINEPAK_DECODER),yes)
36 39
    OBJS+= cinepak.o
37 40
endif
libavcodec/allcodecs.c
529 529
#ifdef CONFIG_AVS_DECODER
530 530
    register_avcodec(&avs_decoder);
531 531
#endif //CONFIG_AVS_DECODER
532
#ifdef CONFIG_CAVS_DECODER
533
    register_avcodec(&cavs_decoder);
534
#endif //CONFIG_CAVS_DECODER
532 535
#ifdef CONFIG_RAWVIDEO_DECODER
533 536
    register_avcodec(&rawvideo_decoder);
534 537
#endif //CONFIG_RAWVIDEO_DECODER
......
637 640
    /* parsers */
638 641
    av_register_codec_parser(&mpegvideo_parser);
639 642
    av_register_codec_parser(&mpeg4video_parser);
643
    av_register_codec_parser(&cavsvideo_parser);
640 644
#if defined(CONFIG_H261_DECODER) || defined(CONFIG_H261_ENCODER)
641 645
    av_register_codec_parser(&h261_parser);
642 646
#endif
libavcodec/cavs.c
76 76
    /* intra prediction is done with un-deblocked samples
77 77
     they are saved here before deblocking the MB  */
78 78
    uint8_t *top_border_y, *top_border_u, *top_border_v;
79
    uint8_t left_border_y[16], left_border_u[8], left_border_v[8];
79
    uint8_t left_border_y[16], left_border_u[10], left_border_v[10];
80 80
    uint8_t topleft_border_y, topleft_border_u, topleft_border_v;
81 81

  
82 82
    void (*intra_pred_l[8])(uint8_t *d,uint8_t *top,uint8_t *left,int stride);
......
136 136
    tc    =    tc_tab[clip(qp_avg + h->alpha_offset,0,63)];
137 137

  
138 138
static void filter_mb(AVSContext *h, enum mb_t mb_type) {
139
    uint8_t bs[8];
139
    DECLARE_ALIGNED_8(uint8_t, bs[8]);
140 140
    int qp_avg, alpha, beta, tc;
141 141
    int i;
142 142

  
143 143
    /* save un-deblocked lines */
144 144
    h->topleft_border_y = h->top_border_y[h->mbx*16+15];
145
    h->topleft_border_u = h->top_border_u[h->mbx*8+7];
146
    h->topleft_border_v = h->top_border_v[h->mbx*8+7];
145
    h->topleft_border_u = h->top_border_u[h->mbx*10+8];
146
    h->topleft_border_v = h->top_border_v[h->mbx*10+8];
147 147
    memcpy(&h->top_border_y[h->mbx*16], h->cy + 15* h->l_stride,16);
148
    memcpy(&h->top_border_u[h->mbx* 8], h->cu +  7* h->c_stride,8);
149
    memcpy(&h->top_border_v[h->mbx* 8], h->cv +  7* h->c_stride,8);
148
    memcpy(&h->top_border_u[h->mbx*10+1], h->cu +  7* h->c_stride,8);
149
    memcpy(&h->top_border_v[h->mbx*10+1], h->cv +  7* h->c_stride,8);
150 150
    for(i=0;i<8;i++) {
151 151
        h->left_border_y[i*2+0] = *(h->cy + 15 + (i*2+0)*h->l_stride);
152 152
        h->left_border_y[i*2+1] = *(h->cy + 15 + (i*2+1)*h->l_stride);
153
        h->left_border_u[i] = *(h->cu + 7 + i*h->c_stride);
154
        h->left_border_v[i] = *(h->cv + 7 + i*h->c_stride);
153
        h->left_border_u[i+1] = *(h->cu + 7 + i*h->c_stride);
154
        h->left_border_v[i+1] = *(h->cv + 7 + i*h->c_stride);
155 155
    }
156 156
    if(!h->loop_filter_disable) {
157 157
        /* clear bs */
......
286 286
    }
287 287
}
288 288

  
289
static inline void load_intra_pred_chroma(uint8_t *stop, uint8_t *sleft,
290
                                          uint8_t stopleft, uint8_t *dtop,
291
                                          uint8_t *dleft, int stride, int flags) {
292
    int i;
293

  
294
    if(flags & A_AVAIL) {
295
        for(i=0; i<8; i++)
296
            dleft[i+1] = sleft[i];
297
        dleft[0] = dleft[1];
298
        dleft[9] = dleft[8];
299
    }
300
    if(flags & B_AVAIL) {
301
        for(i=0; i<8; i++)
302
            dtop[i+1] = stop[i];
303
        dtop[0] = dtop[1];
304
        dtop[9] = dtop[8];
305
        if(flags & A_AVAIL)
306
            dleft[0] = dtop[0] = stopleft;
307
    }
308
}
309

  
310 289
static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
311 290
    int y;
312 291
    uint64_t a = *((uint64_t *)(&top[1]));
......
394 373

  
395 374
#undef LOWPASS
396 375

  
397
static inline void modify_pred(const int8_t *mod_table, int *mode) {
376
static inline void modify_pred(const int_fast8_t *mod_table, int *mode) {
398 377
    int newmode = mod_table[*mode];
399 378
    if(newmode < 0) {
400 379
        av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n");
......
688 667

  
689 668
/* kth-order exponential golomb code */
690 669
static inline int get_ue_code(GetBitContext *gb, int order) {
691
    if(order)
692
        return (get_ue_golomb(gb) << order) + get_bits(gb,order);
670
    if(order) {
671
        int ret = get_ue_golomb(gb) << order;
672
        return ret + get_bits(gb,order);
673
    }
693 674
    return get_ue_golomb(gb);
694 675
}
695 676

  
......
730 711
        run_buf[i] = run;
731 712
    }
732 713
    /* inverse scan and dequantization */
733
    for(i=i-1;i>=0;i--) {
714
    while(--i >= 0){
734 715
        pos += 1 + run_buf[i];
735 716
        if(pos > 63) {
736 717
            av_log(h->s.avctx, AV_LOG_ERROR,
......
920 901
    }
921 902

  
922 903
    /* chroma intra prediction */
923
    load_intra_pred_chroma(&h->top_border_u[h->mbx*8], h->left_border_u,
924
                           h->topleft_border_u, top, left, h->c_stride, h->flags);
925
    h->intra_pred_c[pred_mode_uv](h->cu, top, left, h->c_stride);
926
    load_intra_pred_chroma(&h->top_border_v[h->mbx*8], h->left_border_v,
927
                           h->topleft_border_v, top, left, h->c_stride, h->flags);
928
    h->intra_pred_c[pred_mode_uv](h->cv, top, left, h->c_stride);
904
    /* extend borders by one pixel */
905
    h->left_border_u[9] = h->left_border_u[8];
906
    h->left_border_v[9] = h->left_border_v[8];
907
    h->top_border_u[h->mbx*10+9] = h->top_border_u[h->mbx*10+8];
908
    h->top_border_v[h->mbx*10+9] = h->top_border_v[h->mbx*10+8];
909
    if(h->mbx && h->mby) {
910
        h->top_border_u[h->mbx*10] = h->left_border_u[0] = h->topleft_border_u;
911
        h->top_border_v[h->mbx*10] = h->left_border_v[0] = h->topleft_border_v;
912
    } else {
913
        h->left_border_u[0] = h->left_border_u[1];
914
        h->left_border_v[0] = h->left_border_v[1];
915
        h->top_border_u[h->mbx*10] = h->top_border_u[h->mbx*10+1];
916
        h->top_border_v[h->mbx*10] = h->top_border_v[h->mbx*10+1];
917
    }
918
    h->intra_pred_c[pred_mode_uv](h->cu, &h->top_border_u[h->mbx*10],
919
                                  h->left_border_u, h->c_stride);
920
    h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx*10],
921
                                  h->left_border_v, h->c_stride);
929 922

  
930 923
    decode_residual_chroma(h);
931 924
    filter_mb(h,I_8X8);
......
1324 1317
    h->top_qp       = av_malloc( h->mb_width);
1325 1318
    h->top_mv[0]    = av_malloc((h->mb_width*2+1)*sizeof(vector_t));
1326 1319
    h->top_mv[1]    = av_malloc((h->mb_width*2+1)*sizeof(vector_t));
1327
    h->top_pred_Y   = av_malloc( h->mb_width*2*sizeof(int));
1320
    h->top_pred_Y   = av_malloc( h->mb_width*2*sizeof(*h->top_pred_Y));
1328 1321
    h->top_border_y = av_malloc((h->mb_width+1)*16);
1329
    h->top_border_u = av_malloc((h->mb_width+1)*8);
1330
    h->top_border_v = av_malloc((h->mb_width+1)*8);
1322
    h->top_border_u = av_malloc((h->mb_width)*10);
1323
    h->top_border_v = av_malloc((h->mb_width)*10);
1331 1324

  
1332 1325
    /* alloc space for co-located MVs and types */
1333 1326
    h->col_mv       = av_malloc( h->mb_width*h->mb_height*4*sizeof(vector_t));
......
1336 1329

  
1337 1330
static int decode_seq_header(AVSContext *h) {
1338 1331
    MpegEncContext *s = &h->s;
1339
    extern const AVRational frame_rate_tab[];
1332
    extern const AVRational ff_frame_rate_tab[];
1340 1333
    int frame_rate_code;
1341 1334

  
1342 1335
    h->profile =         get_bits(&s->gb,8);
......
1354 1347
    s->low_delay =       get_bits1(&s->gb);
1355 1348
    h->mb_width  = (s->width  + 15) >> 4;
1356 1349
    h->mb_height = (s->height + 15) >> 4;
1357
    h->s.avctx->time_base.den = frame_rate_tab[frame_rate_code].num;
1358
    h->s.avctx->time_base.num = frame_rate_tab[frame_rate_code].den;
1350
    h->s.avctx->time_base.den = ff_frame_rate_tab[frame_rate_code].num;
1351
    h->s.avctx->time_base.num = ff_frame_rate_tab[frame_rate_code].den;
1359 1352
    h->s.avctx->width  = s->width;
1360 1353
    h->s.avctx->height = s->height;
1361 1354
    if(!h->top_qp)
......
1541 1534
    NULL,
1542 1535
    cavs_decode_end,
1543 1536
    cavs_decode_frame,
1544
    CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY, //FIXME is this correct ?
1537
    CODEC_CAP_DR1 | CODEC_CAP_DELAY,
1545 1538
    .flush= ff_cavs_flush,
1546 1539
};
libavcodec/cavsdata.h
187 187
  32771,35734,38965,42497,46341,50535,55109,60099
188 188
};
189 189

  
190
typedef struct {
190
DECLARE_ALIGNED_8(typedef, struct) {
191 191
    int16_t x;
192 192
    int16_t y;
193 193
    int16_t dist;
libavcodec/cavsdsp.c
22 22

  
23 23
#include <stdio.h>
24 24
#include "dsputil.h"
25
#include "cavsdsp.h"
26 25

  
27 26
/*****************************************************************************
28 27
 *
......
110 109
#undef Q1
111 110
#undef Q2
112 111

  
113
void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc,
112
static void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc,
114 113
                           int bs1, int bs2) {
115 114
    int i;
116 115
    if(bs1==2)
......
126 125
    }
127 126
}
128 127

  
129
void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc,
128
static void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc,
130 129
                           int bs1, int bs2) {
131 130
    int i;
132 131
    if(bs1==2)
......
142 141
    }
143 142
}
144 143

  
145
void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc,
144
static void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc,
146 145
                           int bs1, int bs2) {
147 146
    int i;
148 147
    if(bs1==2)
......
158 157
    }
159 158
}
160 159

  
161
void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc,
160
static void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc,
162 161
                           int bs1, int bs2) {
163 162
    int i;
164 163
    if(bs1==2)
......
180 179
 *
181 180
 ****************************************************************************/
182 181

  
183
void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) {
182
static void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) {
184 183
    int i;
185 184
    DCTELEM (*src)[8] = (DCTELEM(*)[8])block;
186 185
    uint8_t *cm = cropTbl + MAX_NEG_CROP;
......
416 415
}\
417 416

  
418 417
#define CAVS_MC(OPNAME, SIZE) \
419
void OPNAME ## cavs_qpel ## SIZE ## _mc00_c (uint8_t *dst, uint8_t *src, int stride){\
420
    OPNAME ## pixels ## SIZE ## _c(dst, src, stride, SIZE);\
421
}\
422
void OPNAME ## cavs_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
418
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
423 419
    OPNAME ## cavs_filt ## SIZE ## _h_qpel_l(dst, src, stride, stride);\
424 420
}\
425 421
\
426
void OPNAME ## cavs_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\
422
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\
427 423
    OPNAME ## cavs_filt ## SIZE ## _h_hpel(dst, src, stride, stride);\
428 424
}\
429 425
\
430
void OPNAME ## cavs_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\
426
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\
431 427
    OPNAME ## cavs_filt ## SIZE ## _h_qpel_r(dst, src, stride, stride);\
432 428
}\
433 429
\
434
void OPNAME ## cavs_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\
430
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\
435 431
    OPNAME ## cavs_filt ## SIZE ## _v_qpel_l(dst, src, stride, stride);\
436 432
}\
437 433
\
438
void OPNAME ## cavs_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\
434
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\
439 435
    OPNAME ## cavs_filt ## SIZE ## _v_hpel(dst, src, stride, stride);\
440 436
}\
441 437
\
442
void OPNAME ## cavs_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\
438
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\
443 439
    OPNAME ## cavs_filt ## SIZE ## _v_qpel_r(dst, src, stride, stride);\
444 440
}\
445 441
\
446
void OPNAME ## cavs_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\
442
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\
447 443
  OPNAME ## cavs_filt ## SIZE ## _hv_jj(dst, src, NULL, stride, stride); \
448 444
}\
449 445
\
450
void OPNAME ## cavs_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\
446
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\
451 447
  OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src, stride, stride); \
452 448
}\
453 449
\
454
void OPNAME ## cavs_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\
450
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\
455 451
  OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+stride, stride, stride); \
456 452
}\
457 453
\
458
void OPNAME ## cavs_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\
454
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\
459 455
  OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+1, stride, stride); \
460 456
}\
461 457
\
462
void OPNAME ## cavs_qpel ## SIZE ## _mc33_c(uint8_t *dst, uint8_t *src, int stride){\
458
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc33_c(uint8_t *dst, uint8_t *src, int stride){\
463 459
  OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+stride+1,stride, stride); \
464 460
}\
465 461
\
466
void OPNAME ## cavs_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\
462
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\
467 463
  OPNAME ## cavs_filt ## SIZE ## _hv_ff(dst, src, src+stride+1,stride, stride); \
468 464
}\
469 465
\
470
void OPNAME ## cavs_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\
466
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\
471 467
  OPNAME ## cavs_filt ## SIZE ## _hv_ii(dst, src, src+stride+1,stride, stride); \
472 468
}\
473 469
\
474
void OPNAME ## cavs_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\
470
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\
475 471
  OPNAME ## cavs_filt ## SIZE ## _hv_kk(dst, src, src+stride+1,stride, stride); \
476 472
}\
477 473
\
478
void OPNAME ## cavs_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\
474
static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\
479 475
  OPNAME ## cavs_filt ## SIZE ## _hv_qq(dst, src, src+stride+1,stride, stride); \
480 476
}\
481 477

  
......
509 505
CAVS_MC(put_, 16)
510 506
CAVS_MC(avg_, 8)
511 507
CAVS_MC(avg_, 16)
508

  
509
void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride);
510
void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride);
511
void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride);
512
void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride);
513

  
514
void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx) {
515
#define dspfunc(PFX, IDX, NUM) \
516
    c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_c; \
517
    c->PFX ## _pixels_tab[IDX][ 1] = ff_ ## PFX ## NUM ## _mc10_c; \
518
    c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_c; \
519
    c->PFX ## _pixels_tab[IDX][ 3] = ff_ ## PFX ## NUM ## _mc30_c; \
520
    c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_c; \
521
    c->PFX ## _pixels_tab[IDX][ 5] = ff_ ## PFX ## NUM ## _mc11_c; \
522
    c->PFX ## _pixels_tab[IDX][ 6] = ff_ ## PFX ## NUM ## _mc21_c; \
523
    c->PFX ## _pixels_tab[IDX][ 7] = ff_ ## PFX ## NUM ## _mc31_c; \
524
    c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_c; \
525
    c->PFX ## _pixels_tab[IDX][ 9] = ff_ ## PFX ## NUM ## _mc12_c; \
526
    c->PFX ## _pixels_tab[IDX][10] = ff_ ## PFX ## NUM ## _mc22_c; \
527
    c->PFX ## _pixels_tab[IDX][11] = ff_ ## PFX ## NUM ## _mc32_c; \
528
    c->PFX ## _pixels_tab[IDX][12] = ff_ ## PFX ## NUM ## _mc03_c; \
529
    c->PFX ## _pixels_tab[IDX][13] = ff_ ## PFX ## NUM ## _mc13_c; \
530
    c->PFX ## _pixels_tab[IDX][14] = ff_ ## PFX ## NUM ## _mc23_c; \
531
    c->PFX ## _pixels_tab[IDX][15] = ff_ ## PFX ## NUM ## _mc33_c
532
    dspfunc(put_cavs_qpel, 0, 16);
533
    dspfunc(put_cavs_qpel, 1, 8);
534
    dspfunc(avg_cavs_qpel, 0, 16);
535
    dspfunc(avg_cavs_qpel, 1, 8);
536
    c->cavs_filter_lv = cavs_filter_lv_c;
537
    c->cavs_filter_lh = cavs_filter_lh_c;
538
    c->cavs_filter_cv = cavs_filter_cv_c;
539
    c->cavs_filter_ch = cavs_filter_ch_c;
540
    c->cavs_idct8_add = cavs_idct8_add_c;
541
}
libavcodec/cavsdsp.h
1
/*
2
 * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
3
 * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer@gmx.de>
4
 *
5
 * DSP function prototypes
6
 *
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2 of the License, or (at your option) any later version.
11
 *
12
 * This library is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this library; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 */
21

  
22
void put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride);
23
void put_cavs_qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride);
24
void put_cavs_qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride);
25
void put_cavs_qpel16_mc03_c(uint8_t *dst, uint8_t *src, int stride);
26
void put_cavs_qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride);
27
void put_cavs_qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride);
28
void put_cavs_qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride);
29
void put_cavs_qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride);
30
void put_cavs_qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride);
31
void put_cavs_qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride);
32
void put_cavs_qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride);
33
void put_cavs_qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride);
34
void put_cavs_qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride);
35
void put_cavs_qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride);
36
void put_cavs_qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride);
37
void put_cavs_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride);
38
void put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride);
39
void put_cavs_qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride);
40
void put_cavs_qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride);
41
void put_cavs_qpel8_mc03_c(uint8_t *dst, uint8_t *src, int stride);
42
void put_cavs_qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride);
43
void put_cavs_qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride);
44
void put_cavs_qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride);
45
void put_cavs_qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride);
46
void put_cavs_qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride);
47
void put_cavs_qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride);
48
void put_cavs_qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride);
49
void put_cavs_qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride);
50
void put_cavs_qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride);
51
void put_cavs_qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride);
52
void put_cavs_qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride);
53
void put_cavs_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride);
54
void avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride);
55
void avg_cavs_qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride);
56
void avg_cavs_qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride);
57
void avg_cavs_qpel16_mc03_c(uint8_t *dst, uint8_t *src, int stride);
58
void avg_cavs_qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride);
59
void avg_cavs_qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride);
60
void avg_cavs_qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride);
61
void avg_cavs_qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride);
62
void avg_cavs_qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride);
63
void avg_cavs_qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride);
64
void avg_cavs_qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride);
65
void avg_cavs_qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride);
66
void avg_cavs_qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride);
67
void avg_cavs_qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride);
68
void avg_cavs_qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride);
69
void avg_cavs_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride);
70
void avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride);
71
void avg_cavs_qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride);
72
void avg_cavs_qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride);
73
void avg_cavs_qpel8_mc03_c(uint8_t *dst, uint8_t *src, int stride);
74
void avg_cavs_qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride);
75
void avg_cavs_qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride);
76
void avg_cavs_qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride);
77
void avg_cavs_qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride);
78
void avg_cavs_qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride);
79
void avg_cavs_qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride);
80
void avg_cavs_qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride);
81
void avg_cavs_qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride);
82
void avg_cavs_qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride);
83
void avg_cavs_qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride);
84
void avg_cavs_qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride);
85
void avg_cavs_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride);
86
void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2);
87
void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2);
88
void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2);
89
void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2);
90
void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride);
91

  
92
void put_pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h);
93
void put_pixels16_c(uint8_t *block, const uint8_t *pixels, int line_size, int h);
94
void avg_pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h);
95
void avg_pixels16_c(uint8_t *block, const uint8_t *pixels, int line_size, int h);
libavcodec/dsputil.c
2570 2570
    }
2571 2571
}
2572 2572

  
2573
/* AVS specific */
2574
void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx);
2575

  
2576
void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
2577
    put_pixels8_c(dst, src, stride, 8);
2578
}
2579
void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
2580
    avg_pixels8_c(dst, src, stride, 8);
2581
}
2582
void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
2583
    put_pixels16_c(dst, src, stride, 16);
2584
}
2585
void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
2586
    avg_pixels16_c(dst, src, stride, 16);
2587
}
2588

  
2573 2589
static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int w){
2574 2590
    uint8_t *cm = cropTbl + MAX_NEG_CROP;
2575 2591
    int i;
......
3989 4005
    c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c;
3990 4006
    c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c;
3991 4007

  
4008
    ff_cavsdsp_init(c,avctx);
4009

  
3992 4010
    c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c;
3993 4011
    c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;
3994 4012
    c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;
libavcodec/dsputil.h
274 274
    h264_weight_func weight_h264_pixels_tab[10];
275 275
    h264_biweight_func biweight_h264_pixels_tab[10];
276 276

  
277
    /* AVS specific */
278
    qpel_mc_func put_cavs_qpel_pixels_tab[2][16];
279
    qpel_mc_func avg_cavs_qpel_pixels_tab[2][16];
280
    void (*cavs_filter_lv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
281
    void (*cavs_filter_lh)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
282
    void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
283
    void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
284
    void (*cavs_idct8_add)(uint8_t *dst, DCTELEM *block, int stride);
285

  
277 286
    me_cmp_func pix_abs[2][4];
278 287

  
279 288
    /* huffyuv specific */
libavcodec/parser.c
533 533
    return next;
534 534
}
535 535

  
536
static int cavsvideo_parse(AVCodecParserContext *s,
537
                           AVCodecContext *avctx,
538
                           uint8_t **poutbuf, int *poutbuf_size,
539
                           const uint8_t *buf, int buf_size)
540
{
541
    ParseContext *pc = s->priv_data;
542
    int next;
543

  
544
    if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
545
        next= buf_size;
546
    }else{
547
        next= ff_cavs_find_frame_end(pc, buf, buf_size);
548

  
549
        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
550
            *poutbuf = NULL;
551
            *poutbuf_size = 0;
552
            return buf_size;
553
        }
554
    }
555
    *poutbuf = (uint8_t *)buf;
556
    *poutbuf_size = buf_size;
557
    return next;
558
}
559

  
536 560
static int mpeg4video_split(AVCodecContext *avctx,
537 561
                           const uint8_t *buf, int buf_size)
538 562
{
......
987 1011
    mpeg4video_split,
988 1012
};
989 1013

  
1014
AVCodecParser cavsvideo_parser = {
1015
    { CODEC_ID_CAVS },
1016
    sizeof(ParseContext1),
1017
    NULL,
1018
    cavsvideo_parse,
1019
    parse1_close,
1020
    mpeg4video_split,
1021
};
1022

  
990 1023
AVCodecParser mpegaudio_parser = {
991 1024
    { CODEC_ID_MP2, CODEC_ID_MP3 },
992 1025
    sizeof(MpegAudioParseContext),

Also available in: Unified diff