Update avcodec to 20080825
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27563 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,26 +3,28 @@
|
||||
* Copyright (c) 2000,2001 Fabrice Bellard.
|
||||
* Copyright (c) 2002-2004 Michael Niedermayer
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file rv10.c
|
||||
* RV10 codec.
|
||||
*/
|
||||
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "mpegvideo.h"
|
||||
@@ -67,7 +69,7 @@ static const uint16_t rv_lum_code[256] =
|
||||
0x0f78, 0x0f79, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f7e, 0x0f7f,
|
||||
};
|
||||
|
||||
static const uint8_t rv_lum_bits[256] =
|
||||
static const uint8_t rv_lum_bits[256] =
|
||||
{
|
||||
14, 12, 12, 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12, 12, 12, 12,
|
||||
@@ -193,12 +195,12 @@ int rv_decode_dc(MpegEncContext *s, int n)
|
||||
} else if (code == 0x7d) {
|
||||
code = -128 + get_bits(&s->gb, 7);
|
||||
} else if (code == 0x7e) {
|
||||
if (get_bits(&s->gb, 1) == 0)
|
||||
if (get_bits1(&s->gb) == 0)
|
||||
code = (int8_t)(get_bits(&s->gb, 8) + 1);
|
||||
else
|
||||
code = (int8_t)(get_bits(&s->gb, 8));
|
||||
} else if (code == 0x7f) {
|
||||
get_bits(&s->gb, 11);
|
||||
skip_bits(&s->gb, 11);
|
||||
code = 1;
|
||||
}
|
||||
} else {
|
||||
@@ -214,7 +216,7 @@ int rv_decode_dc(MpegEncContext *s, int n)
|
||||
} else if (code == 0x1fd) {
|
||||
code = -128 + get_bits(&s->gb, 7);
|
||||
} else if (code == 0x1fe) {
|
||||
get_bits(&s->gb, 9);
|
||||
skip_bits(&s->gb, 9);
|
||||
code = 1;
|
||||
} else {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "chroma dc error\n");
|
||||
@@ -235,29 +237,59 @@ void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
int full_frame= 0;
|
||||
|
||||
align_put_bits(&s->pb);
|
||||
|
||||
put_bits(&s->pb, 1, 1); /* marker */
|
||||
|
||||
put_bits(&s->pb, 1, (s->pict_type == P_TYPE));
|
||||
put_bits(&s->pb, 1, 1); /* marker */
|
||||
|
||||
put_bits(&s->pb, 1, 0); /* not PB frame */
|
||||
put_bits(&s->pb, 1, (s->pict_type == FF_P_TYPE));
|
||||
|
||||
put_bits(&s->pb, 1, 0); /* not PB frame */
|
||||
|
||||
put_bits(&s->pb, 5, s->qscale);
|
||||
|
||||
if (s->pict_type == I_TYPE) {
|
||||
/* specific MPEG like DC coding not used */
|
||||
if (s->pict_type == FF_I_TYPE) {
|
||||
/* specific MPEG like DC coding not used */
|
||||
}
|
||||
/* if multiple packets per frame are sent, the position at which
|
||||
to display the macro blocks is coded here */
|
||||
if(!full_frame){
|
||||
put_bits(&s->pb, 6, 0); /* mb_x */
|
||||
put_bits(&s->pb, 6, 0); /* mb_y */
|
||||
put_bits(&s->pb, 6, 0); /* mb_x */
|
||||
put_bits(&s->pb, 6, 0); /* mb_y */
|
||||
put_bits(&s->pb, 12, s->mb_width * s->mb_height);
|
||||
}
|
||||
|
||||
put_bits(&s->pb, 3, 0); /* ignored */
|
||||
put_bits(&s->pb, 3, 0); /* ignored */
|
||||
}
|
||||
|
||||
void rv20_encode_picture_header(MpegEncContext *s, int picture_number){
|
||||
put_bits(&s->pb, 2, s->pict_type); //I 0 vs. 1 ?
|
||||
put_bits(&s->pb, 1, 0); /* unknown bit */
|
||||
put_bits(&s->pb, 5, s->qscale);
|
||||
|
||||
put_sbits(&s->pb, 8, picture_number); //FIXME wrong, but correct is not known
|
||||
s->mb_x= s->mb_y= 0;
|
||||
ff_h263_encode_mba(s);
|
||||
|
||||
put_bits(&s->pb, 1, s->no_rounding);
|
||||
|
||||
assert(s->f_code == 1);
|
||||
assert(s->unrestricted_mv == 1);
|
||||
// assert(s->h263_aic== (s->pict_type == FF_I_TYPE));
|
||||
assert(s->alt_inter_vlc == 0);
|
||||
assert(s->umvplus == 0);
|
||||
assert(s->modified_quant==1);
|
||||
assert(s->loop_filter==1);
|
||||
|
||||
s->h263_aic= s->pict_type == FF_I_TYPE;
|
||||
if(s->h263_aic){
|
||||
s->y_dc_scale_table=
|
||||
s->c_dc_scale_table= ff_aic_dc_scale_table;
|
||||
}else{
|
||||
s->y_dc_scale_table=
|
||||
s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 /* unused, remove? */
|
||||
static int get_num(GetBitContext *gb)
|
||||
{
|
||||
int n, n1;
|
||||
@@ -270,30 +302,30 @@ static int get_num(GetBitContext *gb)
|
||||
return (n << 16) | n1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //CONFIG_ENCODERS
|
||||
|
||||
/* read RV 1.0 compatible frame header */
|
||||
static int rv10_decode_picture_header(MpegEncContext *s)
|
||||
{
|
||||
int mb_count, pb_frame, marker, full_frame, unk;
|
||||
|
||||
full_frame= s->avctx->slice_count==1;
|
||||
//printf("ff:%d\n", full_frame);
|
||||
marker = get_bits(&s->gb, 1);
|
||||
int mb_count, pb_frame, marker, unk, mb_xy;
|
||||
|
||||
if (get_bits(&s->gb, 1))
|
||||
s->pict_type = P_TYPE;
|
||||
//printf("ff:%d\n", full_frame);
|
||||
marker = get_bits1(&s->gb);
|
||||
|
||||
if (get_bits1(&s->gb))
|
||||
s->pict_type = FF_P_TYPE;
|
||||
else
|
||||
s->pict_type = I_TYPE;
|
||||
s->pict_type = FF_I_TYPE;
|
||||
//printf("h:%X ver:%d\n",h,s->rv10_version);
|
||||
if(!marker) av_log(s->avctx, AV_LOG_ERROR, "marker missing\n");
|
||||
pb_frame = get_bits(&s->gb, 1);
|
||||
pb_frame = get_bits1(&s->gb);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame);
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame);
|
||||
#endif
|
||||
|
||||
|
||||
if (pb_frame){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "pb frame not supported\n");
|
||||
return -1;
|
||||
@@ -305,14 +337,14 @@ static int rv10_decode_picture_header(MpegEncContext *s)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (s->pict_type == I_TYPE) {
|
||||
if (s->pict_type == FF_I_TYPE) {
|
||||
if (s->rv10_version == 3) {
|
||||
/* specific MPEG like DC coding not used */
|
||||
s->last_dc[0] = get_bits(&s->gb, 8);
|
||||
s->last_dc[1] = get_bits(&s->gb, 8);
|
||||
s->last_dc[2] = get_bits(&s->gb, 8);
|
||||
#ifdef DEBUG
|
||||
printf("DC:%d %d %d\n",
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "DC:%d %d %d\n",
|
||||
s->last_dc[0],
|
||||
s->last_dc[1],
|
||||
s->last_dc[2]);
|
||||
@@ -321,16 +353,18 @@ static int rv10_decode_picture_header(MpegEncContext *s)
|
||||
}
|
||||
/* if multiple packets per frame are sent, the position at which
|
||||
to display the macro blocks is coded here */
|
||||
if ((!full_frame) || show_bits(&s->gb, 12)==0) {
|
||||
s->mb_x = get_bits(&s->gb, 6); /* mb_x */
|
||||
s->mb_y = get_bits(&s->gb, 6); /* mb_y */
|
||||
|
||||
mb_xy= s->mb_x + s->mb_y*s->mb_width;
|
||||
if(show_bits(&s->gb, 12)==0 || (mb_xy && mb_xy < s->mb_num)){
|
||||
s->mb_x = get_bits(&s->gb, 6); /* mb_x */
|
||||
s->mb_y = get_bits(&s->gb, 6); /* mb_y */
|
||||
mb_count = get_bits(&s->gb, 12);
|
||||
} else {
|
||||
s->mb_x = 0;
|
||||
s->mb_y = 0;
|
||||
mb_count = s->mb_width * s->mb_height;
|
||||
}
|
||||
unk= get_bits(&s->gb, 3); /* ignored */
|
||||
unk= get_bits(&s->gb, 3); /* ignored */
|
||||
//printf("%d\n", unk);
|
||||
s->f_code = 1;
|
||||
s->unrestricted_mv = 1;
|
||||
@@ -341,26 +375,48 @@ static int rv10_decode_picture_header(MpegEncContext *s)
|
||||
static int rv20_decode_picture_header(MpegEncContext *s)
|
||||
{
|
||||
int seq, mb_pos, i;
|
||||
|
||||
|
||||
#if 0
|
||||
GetBitContext gb= s->gb;
|
||||
for(i=0; i<64; i++){
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&gb));
|
||||
if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " ");
|
||||
}
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "\n");
|
||||
#endif
|
||||
#if 0
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, s->height, s->width/4, s->height/4);
|
||||
for(i=0; i<s->avctx->extradata_size; i++){
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "%02X ", ((uint8_t*)s->avctx->extradata)[i]);
|
||||
if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " ");
|
||||
}
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "\n");
|
||||
#endif
|
||||
|
||||
if(s->avctx->sub_id == 0x30202002 || s->avctx->sub_id == 0x30203002){
|
||||
if (get_bits(&s->gb, 3)){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "unknown triplet set\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i= get_bits(&s->gb, 2);
|
||||
switch(i){
|
||||
case 0: s->pict_type= I_TYPE; break;
|
||||
case 1: s->pict_type= I_TYPE; break; //hmm ...
|
||||
case 2: s->pict_type= P_TYPE; break;
|
||||
case 3: s->pict_type= B_TYPE; break;
|
||||
default:
|
||||
case 0: s->pict_type= FF_I_TYPE; break;
|
||||
case 1: s->pict_type= FF_I_TYPE; break; //hmm ...
|
||||
case 2: s->pict_type= FF_P_TYPE; break;
|
||||
case 3: s->pict_type= FF_B_TYPE; break;
|
||||
default:
|
||||
av_log(s->avctx, AV_LOG_ERROR, "unknown frame type\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (get_bits(&s->gb, 1)){
|
||||
|
||||
if(s->last_picture_ptr==NULL && s->pict_type==FF_B_TYPE){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "early B pix\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (get_bits1(&s->gb)){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "unknown bit set\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -371,31 +427,62 @@ static int rv20_decode_picture_header(MpegEncContext *s)
|
||||
return -1;
|
||||
}
|
||||
if(s->avctx->sub_id == 0x30203002){
|
||||
if (get_bits(&s->gb, 1)){
|
||||
if (get_bits1(&s->gb)){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "unknown bit2 set\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(s->avctx->has_b_frames){
|
||||
if (get_bits(&s->gb, 1)){
|
||||
// av_log(s->avctx, AV_LOG_ERROR, "unknown bit3 set\n");
|
||||
int f, new_w, new_h;
|
||||
int v= s->avctx->extradata_size >= 4 ? 7&((uint8_t*)s->avctx->extradata)[1] : 0;
|
||||
|
||||
if (get_bits1(&s->gb)){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "unknown bit3 set\n");
|
||||
// return -1;
|
||||
}
|
||||
seq= get_bits(&s->gb, 15);
|
||||
seq= get_bits(&s->gb, 13)<<2;
|
||||
|
||||
f= get_bits(&s->gb, av_log2(v)+1);
|
||||
|
||||
if(f){
|
||||
new_w= 4*((uint8_t*)s->avctx->extradata)[6+2*f];
|
||||
new_h= 4*((uint8_t*)s->avctx->extradata)[7+2*f];
|
||||
}else{
|
||||
new_w= s->width; //FIXME wrong we of course must save the original in the context
|
||||
new_h= s->height;
|
||||
}
|
||||
if(new_w != s->width || new_h != s->height){
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h);
|
||||
if (avcodec_check_dimensions(s->avctx, new_h, new_w) < 0)
|
||||
return -1;
|
||||
MPV_common_end(s);
|
||||
s->width = s->avctx->width = new_w;
|
||||
s->height = s->avctx->height= new_h;
|
||||
if (MPV_common_init(s) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(s->avctx->debug & FF_DEBUG_PICT_INFO){
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "F %d/%d\n", f, v);
|
||||
}
|
||||
}else{
|
||||
seq= get_bits(&s->gb, 8)*128;
|
||||
}
|
||||
|
||||
// if(s->avctx->sub_id <= 0x20201002){ //0x20201002 definitely needs this
|
||||
mb_pos= ff_h263_decode_mba(s);
|
||||
/* }else{
|
||||
mb_pos= get_bits(&s->gb, av_log2(s->mb_num-1)+1);
|
||||
s->mb_x= mb_pos % s->mb_width;
|
||||
s->mb_y= mb_pos / s->mb_width;
|
||||
}else{
|
||||
seq= get_bits(&s->gb, 8)*128;
|
||||
mb_pos= ff_h263_decode_mba(s);
|
||||
}
|
||||
//printf("%d\n", seq);
|
||||
}*/
|
||||
//av_log(s->avctx, AV_LOG_DEBUG, "%d\n", seq);
|
||||
seq |= s->time &~0x7FFF;
|
||||
if(seq - s->time > 0x4000) seq -= 0x8000;
|
||||
if(seq - s->time < -0x4000) seq += 0x8000;
|
||||
if(seq != s->time){
|
||||
if(s->pict_type!=B_TYPE){
|
||||
if(seq != s->time){
|
||||
if(s->pict_type!=FF_B_TYPE){
|
||||
s->time= seq;
|
||||
s->pp_time= s->time - s->last_non_b_time;
|
||||
s->last_non_b_time= s->time;
|
||||
@@ -403,39 +490,45 @@ static int rv20_decode_picture_header(MpegEncContext *s)
|
||||
s->time= seq;
|
||||
s->pb_time= s->pp_time - (s->last_non_b_time - s->time);
|
||||
if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){
|
||||
printf("messed up order, seeking?, skiping current b frame\n");
|
||||
return FRAME_SKIPED;
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "messed up order, possible from seeking? skipping current b frame\n");
|
||||
return FRAME_SKIPPED;
|
||||
}
|
||||
ff_mpeg4_init_direct_mv(s);
|
||||
}
|
||||
}
|
||||
// printf("%d %d %d %d %d\n", seq, (int)s->time, (int)s->last_non_b_time, s->pp_time, s->pb_time);
|
||||
|
||||
/*for(i=0; i<32; i++){
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
|
||||
}
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "\n");*/
|
||||
s->no_rounding= get_bits1(&s->gb);
|
||||
|
||||
|
||||
s->f_code = 1;
|
||||
s->unrestricted_mv = 1;
|
||||
s->h263_aic= s->pict_type == I_TYPE;
|
||||
s->h263_aic= s->pict_type == FF_I_TYPE;
|
||||
// s->alt_inter_vlc=1;
|
||||
// s->obmc=1;
|
||||
// s->umvplus=1;
|
||||
s->modified_quant=1;
|
||||
s->loop_filter=1;
|
||||
|
||||
|
||||
if(s->avctx->debug & FF_DEBUG_PICT_INFO){
|
||||
av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n",
|
||||
av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n",
|
||||
seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding);
|
||||
}
|
||||
|
||||
assert(s->pict_type != B_TYPE || !s->low_delay);
|
||||
assert(s->pict_type != FF_B_TYPE || !s->low_delay);
|
||||
|
||||
return s->mb_width*s->mb_height - mb_pos;
|
||||
}
|
||||
|
||||
static int rv10_decode_init(AVCodecContext *avctx)
|
||||
static av_cold int rv10_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
static int done=0;
|
||||
|
||||
MPV_decode_defaults(s);
|
||||
|
||||
s->avctx= avctx;
|
||||
s->out_format = FMT_H263;
|
||||
s->codec_id= avctx->codec_id;
|
||||
@@ -443,61 +536,59 @@ static int rv10_decode_init(AVCodecContext *avctx)
|
||||
s->width = avctx->width;
|
||||
s->height = avctx->height;
|
||||
|
||||
switch(avctx->sub_id){
|
||||
case 0x10000000:
|
||||
s->h263_long_vectors= ((uint8_t*)avctx->extradata)[3] & 1;
|
||||
avctx->sub_id= AV_RB32((uint8_t*)avctx->extradata + 4);
|
||||
|
||||
if (avctx->sub_id == 0x10000000) {
|
||||
s->rv10_version= 0;
|
||||
s->h263_long_vectors=0;
|
||||
s->low_delay=1;
|
||||
break;
|
||||
case 0x10003000:
|
||||
} else if (avctx->sub_id == 0x10002000) {
|
||||
s->rv10_version= 3;
|
||||
s->h263_long_vectors=1;
|
||||
s->low_delay=1;
|
||||
break;
|
||||
case 0x10003001:
|
||||
s->obmc=1;
|
||||
} else if (avctx->sub_id == 0x10003000) {
|
||||
s->rv10_version= 3;
|
||||
s->h263_long_vectors=0;
|
||||
s->low_delay=1;
|
||||
break;
|
||||
case 0x20001000:
|
||||
case 0x20100001:
|
||||
case 0x20101001:
|
||||
} else if (avctx->sub_id == 0x10003001) {
|
||||
s->rv10_version= 3;
|
||||
s->low_delay=1;
|
||||
break;
|
||||
case 0x20200002:
|
||||
case 0x30202002:
|
||||
case 0x30203002:
|
||||
} else if ( avctx->sub_id == 0x20001000
|
||||
|| (avctx->sub_id >= 0x20100000 && avctx->sub_id < 0x201a0000)) {
|
||||
s->low_delay=1;
|
||||
} else if ( avctx->sub_id == 0x30202002
|
||||
|| avctx->sub_id == 0x30203002
|
||||
|| (avctx->sub_id >= 0x20200002 && avctx->sub_id < 0x20300000)) {
|
||||
s->low_delay=0;
|
||||
s->avctx->has_b_frames=1;
|
||||
break;
|
||||
default:
|
||||
} else
|
||||
av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id);
|
||||
|
||||
if(avctx->debug & FF_DEBUG_PICT_INFO){
|
||||
av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", avctx->sub_id, avctx->extradata_size >= 4 ? ((uint32_t*)avctx->extradata)[0] : -1);
|
||||
}
|
||||
//printf("ver:%X\n", avctx->sub_id);
|
||||
|
||||
avctx->pix_fmt = PIX_FMT_YUV420P;
|
||||
|
||||
if (MPV_common_init(s) < 0)
|
||||
return -1;
|
||||
|
||||
h263_decode_init_vlc(s);
|
||||
|
||||
s->progressive_sequence=1;
|
||||
|
||||
/* init rv vlc */
|
||||
if (!done) {
|
||||
init_vlc(&rv_dc_lum, DC_VLC_BITS, 256,
|
||||
init_vlc(&rv_dc_lum, DC_VLC_BITS, 256,
|
||||
rv_lum_bits, 1, 1,
|
||||
rv_lum_code, 2, 2);
|
||||
init_vlc(&rv_dc_chrom, DC_VLC_BITS, 256,
|
||||
rv_lum_code, 2, 2, 1);
|
||||
init_vlc(&rv_dc_chrom, DC_VLC_BITS, 256,
|
||||
rv_chrom_bits, 1, 1,
|
||||
rv_chrom_code, 2, 2);
|
||||
rv_chrom_code, 2, 2, 1);
|
||||
done = 1;
|
||||
}
|
||||
|
||||
avctx->pix_fmt = PIX_FMT_YUV420P;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rv10_decode_end(AVCodecContext *avctx)
|
||||
static av_cold int rv10_decode_end(AVCodecContext *avctx)
|
||||
{
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
|
||||
@@ -505,19 +596,13 @@ static int rv10_decode_end(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rv10_decode_packet(AVCodecContext *avctx,
|
||||
uint8_t *buf, int buf_size)
|
||||
static int rv10_decode_packet(AVCodecContext *avctx,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
int i, mb_count, mb_pos, left;
|
||||
int mb_count, mb_pos, left, start_mb_x;
|
||||
|
||||
init_get_bits(&s->gb, buf, buf_size*8);
|
||||
#if 0
|
||||
for(i=0; i<buf_size*8 && i<200; i++)
|
||||
printf("%d", get_bits1(&s->gb));
|
||||
printf("\n");
|
||||
return 0;
|
||||
#endif
|
||||
if(s->codec_id ==CODEC_ID_RV10)
|
||||
mb_count = rv10_decode_picture_header(s);
|
||||
else
|
||||
@@ -526,7 +611,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
|
||||
av_log(s->avctx, AV_LOG_ERROR, "HEADER ERROR\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (s->mb_x >= s->mb_width ||
|
||||
s->mb_y >= s->mb_height) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "POS ERROR %d %d\n", s->mb_x, s->mb_y);
|
||||
@@ -538,31 +623,34 @@ static int rv10_decode_packet(AVCodecContext *avctx,
|
||||
av_log(s->avctx, AV_LOG_ERROR, "COUNT ERROR\n");
|
||||
return -1;
|
||||
}
|
||||
//if(s->pict_type == P_TYPE) return 0;
|
||||
//if(s->pict_type == FF_P_TYPE) return 0;
|
||||
|
||||
if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr==NULL) {
|
||||
if(s->current_picture_ptr){ //FIXME write parser so we always have complete frames?
|
||||
ff_er_frame_end(s);
|
||||
MPV_frame_end(s);
|
||||
s->mb_x= s->mb_y = s->resync_mb_x = s->resync_mb_y= 0;
|
||||
}
|
||||
if(MPV_frame_start(s, avctx) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(s->pict_type == B_TYPE){ //FIXME remove after cleaning mottion_val indexing
|
||||
memset(s->current_picture.motion_val[0], 0, sizeof(int16_t)*2*(s->mb_width*2+2)*(s->mb_height*2+2));
|
||||
ff_er_frame_start(s);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("qscale=%d\n", s->qscale);
|
||||
av_log(avctx, AV_LOG_DEBUG, "qscale=%d\n", s->qscale);
|
||||
#endif
|
||||
|
||||
/* default quantization values */
|
||||
if(s->codec_id== CODEC_ID_RV10){
|
||||
if(s->mb_y==0) s->first_slice_line=1;
|
||||
}else{
|
||||
s->first_slice_line=1;
|
||||
s->first_slice_line=1;
|
||||
s->resync_mb_x= s->mb_x;
|
||||
s->resync_mb_y= s->mb_y;
|
||||
}
|
||||
start_mb_x= s->mb_x;
|
||||
s->resync_mb_y= s->mb_y;
|
||||
if(s->h263_aic){
|
||||
s->y_dc_scale_table=
|
||||
s->y_dc_scale_table=
|
||||
s->c_dc_scale_table= ff_aic_dc_scale_table;
|
||||
}else{
|
||||
s->y_dc_scale_table=
|
||||
@@ -571,7 +659,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
|
||||
|
||||
if(s->modified_quant)
|
||||
s->chroma_qscale_table= ff_h263_chroma_qscale_table;
|
||||
|
||||
|
||||
ff_set_qscale(s, s->qscale);
|
||||
|
||||
s->rv10_first_dc_coded[0] = 0;
|
||||
@@ -581,28 +669,28 @@ static int rv10_decode_packet(AVCodecContext *avctx,
|
||||
s->block_wrap[0]=
|
||||
s->block_wrap[1]=
|
||||
s->block_wrap[2]=
|
||||
s->block_wrap[3]= s->mb_width*2 + 2;
|
||||
s->block_wrap[3]= s->b8_stride;
|
||||
s->block_wrap[4]=
|
||||
s->block_wrap[5]= s->mb_width + 2;
|
||||
s->block_wrap[5]= s->mb_stride;
|
||||
ff_init_block_index(s);
|
||||
/* decode each macroblock */
|
||||
for(i=0;i<mb_count;i++) {
|
||||
|
||||
for(s->mb_num_left= mb_count; s->mb_num_left>0; s->mb_num_left--) {
|
||||
int ret;
|
||||
ff_update_block_index(s);
|
||||
#ifdef DEBUG
|
||||
printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y);
|
||||
av_log(avctx, AV_LOG_DEBUG, "**mb x=%d y=%d\n", s->mb_x, s->mb_y);
|
||||
#endif
|
||||
|
||||
s->dsp.clear_blocks(s->block[0]);
|
||||
|
||||
s->mv_dir = MV_DIR_FORWARD;
|
||||
s->mv_type = MV_TYPE_16X16;
|
||||
s->mv_type = MV_TYPE_16X16;
|
||||
ret=ff_h263_decode_mb(s, s->block);
|
||||
|
||||
if (ret == SLICE_ERROR) {
|
||||
if (ret == SLICE_ERROR || s->gb.size_in_bits < get_bits_count(&s->gb)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y);
|
||||
return -1;
|
||||
}
|
||||
if(s->pict_type != B_TYPE)
|
||||
if(s->pict_type != FF_B_TYPE)
|
||||
ff_h263_update_motion_val(s);
|
||||
MPV_decode_mb(s, s->block);
|
||||
if(s->loop_filter)
|
||||
@@ -618,63 +706,70 @@ static int rv10_decode_packet(AVCodecContext *avctx,
|
||||
if(ret == SLICE_END) break;
|
||||
}
|
||||
|
||||
ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
|
||||
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
static int rv10_decode_frame(AVCodecContext *avctx,
|
||||
static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
|
||||
{
|
||||
if(avctx->slice_count) return avctx->slice_offset[n];
|
||||
else return AV_RL32(buf + n*8);
|
||||
}
|
||||
|
||||
static int rv10_decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *data_size,
|
||||
uint8_t *buf, int buf_size)
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
int i;
|
||||
AVFrame *pict = data;
|
||||
AVFrame *pict = data;
|
||||
int slice_count;
|
||||
const uint8_t *slices_hdr = NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("*****frame %d size=%d\n", avctx->frame_number, buf_size);
|
||||
av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
|
||||
#endif
|
||||
|
||||
/* no supplementary picture */
|
||||
if (buf_size == 0) {
|
||||
*data_size = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(avctx->slice_count){
|
||||
for(i=0; i<avctx->slice_count; i++){
|
||||
int offset= avctx->slice_offset[i];
|
||||
int size;
|
||||
|
||||
if(i+1 == avctx->slice_count)
|
||||
size= buf_size - offset;
|
||||
else
|
||||
size= avctx->slice_offset[i+1] - offset;
|
||||
if(!avctx->slice_count){
|
||||
slice_count = (*buf++) + 1;
|
||||
slices_hdr = buf + 4;
|
||||
buf += 8 * slice_count;
|
||||
}else
|
||||
slice_count = avctx->slice_count;
|
||||
|
||||
if( rv10_decode_packet(avctx, buf+offset, size) < 0 )
|
||||
return -1;
|
||||
}
|
||||
}else{
|
||||
if( rv10_decode_packet(avctx, buf, buf_size) < 0 )
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(s->pict_type == B_TYPE){ //FIXME remove after cleaning mottion_val indexing
|
||||
memset(s->current_picture.motion_val[0], 0, sizeof(int16_t)*2*(s->mb_width*2+2)*(s->mb_height*2+2));
|
||||
for(i=0; i<slice_count; i++){
|
||||
int offset= get_slice_offset(avctx, slices_hdr, i);
|
||||
int size;
|
||||
|
||||
if(i+1 == slice_count)
|
||||
size= buf_size - offset;
|
||||
else
|
||||
size= get_slice_offset(avctx, slices_hdr, i+1) - offset;
|
||||
|
||||
rv10_decode_packet(avctx, buf+offset, size);
|
||||
}
|
||||
|
||||
if(s->mb_y>=s->mb_height){
|
||||
if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){
|
||||
ff_er_frame_end(s);
|
||||
MPV_frame_end(s);
|
||||
|
||||
if(s->pict_type==B_TYPE || s->low_delay){
|
||||
*pict= *(AVFrame*)&s->current_picture;
|
||||
ff_print_debug_info(s, pict);
|
||||
} else {
|
||||
*pict= *(AVFrame*)&s->last_picture;
|
||||
|
||||
if (s->pict_type == FF_B_TYPE || s->low_delay) {
|
||||
*pict= *(AVFrame*)s->current_picture_ptr;
|
||||
} else if (s->last_picture_ptr != NULL) {
|
||||
*pict= *(AVFrame*)s->last_picture_ptr;
|
||||
}
|
||||
|
||||
if(s->last_picture_ptr || s->low_delay){
|
||||
*data_size = sizeof(AVFrame);
|
||||
ff_print_debug_info(s, pict);
|
||||
}
|
||||
|
||||
*data_size = sizeof(AVFrame);
|
||||
}else{
|
||||
*data_size = 0;
|
||||
s->current_picture_ptr= NULL; //so we can detect if frame_end wasnt called (find some nicer solution...)
|
||||
}
|
||||
|
||||
return buf_size;
|
||||
@@ -689,7 +784,8 @@ AVCodec rv10_decoder = {
|
||||
NULL,
|
||||
rv10_decode_end,
|
||||
rv10_decode_frame,
|
||||
CODEC_CAP_DR1
|
||||
CODEC_CAP_DR1,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
|
||||
};
|
||||
|
||||
AVCodec rv20_decoder = {
|
||||
@@ -701,6 +797,8 @@ AVCodec rv20_decoder = {
|
||||
NULL,
|
||||
rv10_decode_end,
|
||||
rv10_decode_frame,
|
||||
CODEC_CAP_DR1
|
||||
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
|
||||
.flush= ff_mpeg_flush,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* RV30 decoder
|
||||
* Copyright (c) 2007 Konstantin Shishkov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file rv30.c
|
||||
* RV30 decoder
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "mpegvideo.h"
|
||||
#include "golomb.h"
|
||||
|
||||
#include "rv34.h"
|
||||
#include "rv30data.h"
|
||||
|
||||
|
||||
static int rv30_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceInfo *si)
|
||||
{
|
||||
int mb_bits;
|
||||
int w = r->s.width, h = r->s.height;
|
||||
int mb_size;
|
||||
|
||||
memset(si, 0, sizeof(SliceInfo));
|
||||
skip_bits(gb, 3);
|
||||
si->type = get_bits(gb, 2);
|
||||
if(si->type == 1) si->type = 0;
|
||||
if(get_bits1(gb))
|
||||
return -1;
|
||||
si->quant = get_bits(gb, 5);
|
||||
skip_bits1(gb);
|
||||
si->pts = get_bits(gb, 13);
|
||||
skip_bits(gb, r->rpr);
|
||||
si->width = w;
|
||||
si->height = h;
|
||||
mb_size = ((w + 15) >> 4) * ((h + 15) >> 4);
|
||||
mb_bits = ff_rv34_get_start_offset(gb, mb_size);
|
||||
si->start = get_bits(gb, mb_bits);
|
||||
skip_bits1(gb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode 4x4 intra types array.
|
||||
*/
|
||||
static int rv30_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t *dst)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
for(i = 0; i < 4; i++, dst += r->s.b4_stride - 4){
|
||||
for(j = 0; j < 4; j+= 2){
|
||||
int code = svq3_get_ue_golomb(gb) << 1;
|
||||
if(code >= 81*2){
|
||||
av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction code\n");
|
||||
return -1;
|
||||
}
|
||||
for(k = 0; k < 2; k++){
|
||||
int A = dst[-r->s.b4_stride] + 1;
|
||||
int B = dst[-1] + 1;
|
||||
*dst++ = rv30_itype_from_context[A * 90 + B * 9 + rv30_itype_code[code + k]];
|
||||
if(dst[-1] == 9){
|
||||
av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction mode\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode macroblock information.
|
||||
*/
|
||||
static int rv30_decode_mb_info(RV34DecContext *r)
|
||||
{
|
||||
static const int rv30_p_types[6] = { RV34_MB_SKIP, RV34_MB_P_16x16, RV34_MB_P_8x8, -1, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };
|
||||
static const int rv30_b_types[6] = { RV34_MB_SKIP, RV34_MB_B_DIRECT, RV34_MB_B_FORWARD, RV34_MB_B_BACKWARD, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };
|
||||
MpegEncContext *s = &r->s;
|
||||
GetBitContext *gb = &s->gb;
|
||||
int code = svq3_get_ue_golomb(gb);
|
||||
|
||||
if(code > 11){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Incorrect MB type code\n");
|
||||
return -1;
|
||||
}
|
||||
if(code > 5){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "dquant needed\n");
|
||||
code -= 6;
|
||||
}
|
||||
if(s->pict_type != FF_B_TYPE)
|
||||
return rv30_p_types[code];
|
||||
else
|
||||
return rv30_b_types[code];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize decoder.
|
||||
*/
|
||||
static av_cold int rv30_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
RV34DecContext *r = avctx->priv_data;
|
||||
|
||||
r->rv30 = 1;
|
||||
ff_rv34_decode_init(avctx);
|
||||
if(avctx->extradata_size < 2){
|
||||
av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n");
|
||||
return -1;
|
||||
}
|
||||
r->rpr = (avctx->extradata[1] & 7) >> 1;
|
||||
r->rpr = FFMIN(r->rpr + 1, 3);
|
||||
r->parse_slice_header = rv30_parse_slice_header;
|
||||
r->decode_intra_types = rv30_decode_intra_types;
|
||||
r->decode_mb_info = rv30_decode_mb_info;
|
||||
r->luma_dc_quant_i = rv30_luma_dc_quant;
|
||||
r->luma_dc_quant_p = rv30_luma_dc_quant;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodec rv30_decoder = {
|
||||
"rv30",
|
||||
CODEC_TYPE_VIDEO,
|
||||
CODEC_ID_RV30,
|
||||
sizeof(RV34DecContext),
|
||||
rv30_decode_init,
|
||||
NULL,
|
||||
ff_rv34_decode_end,
|
||||
ff_rv34_decode_frame,
|
||||
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("RealVideo 3.0"),
|
||||
};
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* RealVideo 3 decoder
|
||||
* copyright (c) 2007 Konstantin Shishkov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file rv30data.h
|
||||
* miscellaneous RV30 tables
|
||||
*/
|
||||
|
||||
#ifndef FFMPEG_RV30DATA_H
|
||||
#define FFMPEG_RV30DATA_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** DC quantizer mapping for RV30 */
|
||||
static const uint8_t rv30_luma_dc_quant[32] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 22, 22, 23, 23, 23, 24, 24, 25, 25
|
||||
};
|
||||
|
||||
/**
|
||||
* This table is used for storing the differences
|
||||
* between the predicted and the real intra type.
|
||||
*/
|
||||
static const uint8_t rv30_itype_code[9*9*2] = {
|
||||
0, 0, 0, 1, 1, 0, 1, 1, 0, 2, 2, 0, 0, 3, 3, 0, 1, 2,
|
||||
2, 1, 0, 4, 4, 0, 3, 1, 1, 3, 0, 5, 5, 0, 2, 2, 1, 4,
|
||||
4, 1, 0, 6, 3, 2, 1, 5, 2, 3, 5, 1, 6, 0, 0, 7, 4, 2,
|
||||
2, 4, 3, 3, 6, 1, 1, 6, 7, 0, 0, 8, 5, 2, 4, 3, 2, 5,
|
||||
3, 4, 1, 7, 4, 4, 7, 1, 8, 0, 6, 2, 3, 5, 5, 3, 2, 6,
|
||||
1, 8, 2, 7, 7, 2, 8, 1, 5, 4, 4, 5, 3, 6, 6, 3, 8, 2,
|
||||
4, 6, 5, 5, 6, 4, 2, 8, 7, 3, 3, 7, 6, 5, 5, 6, 7, 4,
|
||||
4, 7, 8, 3, 3, 8, 7, 5, 8, 4, 5, 7, 4, 8, 6, 6, 7, 6,
|
||||
5, 8, 8, 5, 6, 7, 8, 6, 7, 7, 6, 8, 8, 7, 7, 8, 8, 8,
|
||||
};
|
||||
|
||||
/**
|
||||
* This table is used for retrieving the current intra type
|
||||
* based on its neighbors and adjustment provided by
|
||||
* code read and decoded before.
|
||||
*
|
||||
* This is really a three-dimensional matrix with dimensions
|
||||
* [-1..9][-1..9][0..9]. The first and second coordinates are
|
||||
* detemined by the top and left neighbors (-1 if unavailable).
|
||||
*/
|
||||
static const uint8_t rv30_itype_from_context[900] = {
|
||||
0, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
0, 2, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
2, 0, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
|
||||
0, 1, 9, 9, 9, 9, 9, 9, 9,
|
||||
0, 2, 1, 6, 4, 8, 5, 7, 3,
|
||||
1, 0, 2, 6, 5, 4, 3, 8, 7,
|
||||
2, 8, 0, 1, 7, 4, 3, 6, 5,
|
||||
2, 0, 1, 3, 8, 5, 4, 7, 6,
|
||||
2, 0, 1, 4, 6, 7, 8, 3, 5,
|
||||
0, 1, 5, 2, 6, 3, 8, 4, 7,
|
||||
0, 1, 6, 2, 4, 7, 5, 8, 3,
|
||||
2, 7, 0, 1, 4, 8, 6, 3, 5,
|
||||
2, 8, 0, 1, 7, 3, 4, 5, 6,
|
||||
|
||||
1, 0, 9, 9, 9, 9, 9, 9, 9,
|
||||
1, 2, 5, 6, 3, 0, 4, 8, 7,
|
||||
1, 6, 2, 5, 3, 0, 4, 8, 7,
|
||||
2, 1, 7, 6, 8, 3, 5, 0, 4,
|
||||
1, 2, 5, 3, 6, 8, 4, 7, 0,
|
||||
1, 6, 2, 0, 4, 5, 8, 7, 3,
|
||||
1, 5, 2, 6, 3, 8, 4, 0, 7,
|
||||
1, 6, 0, 2, 4, 5, 7, 3, 8,
|
||||
2, 1, 7, 6, 0, 8, 5, 4, 3,
|
||||
1, 2, 7, 8, 3, 4, 5, 6, 0,
|
||||
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
0, 2, 1, 8, 7, 6, 5, 4, 3,
|
||||
1, 2, 0, 6, 5, 7, 4, 8, 3,
|
||||
2, 8, 7, 1, 0, 6, 4, 3, 5,
|
||||
2, 0, 8, 1, 3, 7, 5, 4, 6,
|
||||
2, 0, 4, 1, 7, 8, 6, 3, 5,
|
||||
2, 0, 1, 5, 8, 4, 6, 7, 3,
|
||||
2, 0, 6, 1, 4, 7, 8, 5, 3,
|
||||
2, 7, 8, 1, 0, 5, 4, 6, 3,
|
||||
2, 8, 7, 1, 0, 4, 3, 6, 5,
|
||||
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
0, 2, 1, 3, 5, 8, 6, 4, 7,
|
||||
1, 0, 2, 5, 3, 6, 4, 8, 7,
|
||||
2, 8, 1, 0, 3, 5, 7, 6, 4,
|
||||
3, 2, 5, 8, 1, 4, 6, 7, 0,
|
||||
4, 2, 0, 6, 1, 5, 8, 3, 7,
|
||||
5, 3, 1, 2, 8, 6, 4, 0, 7,
|
||||
1, 6, 0, 2, 4, 5, 8, 3, 7,
|
||||
2, 7, 0, 1, 5, 4, 8, 6, 3,
|
||||
2, 8, 3, 5, 1, 0, 7, 6, 4,
|
||||
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
2, 0, 6, 1, 4, 7, 5, 8, 3,
|
||||
1, 6, 2, 0, 4, 5, 3, 7, 8,
|
||||
2, 8, 7, 6, 4, 0, 1, 5, 3,
|
||||
4, 2, 1, 0, 6, 8, 3, 5, 7,
|
||||
4, 2, 6, 0, 1, 5, 7, 8, 3,
|
||||
1, 2, 5, 0, 6, 3, 4, 7, 8,
|
||||
6, 4, 0, 1, 2, 7, 5, 3, 8,
|
||||
2, 7, 4, 6, 0, 1, 8, 5, 3,
|
||||
2, 8, 7, 4, 6, 1, 3, 5, 0,
|
||||
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
5, 1, 2, 3, 6, 8, 0, 4, 7,
|
||||
1, 5, 6, 3, 2, 0, 4, 8, 7,
|
||||
2, 1, 5, 3, 6, 8, 7, 4, 0,
|
||||
5, 3, 1, 2, 6, 8, 4, 7, 0,
|
||||
1, 6, 2, 4, 5, 8, 0, 3, 7,
|
||||
5, 1, 3, 6, 2, 0, 8, 4, 7,
|
||||
1, 6, 5, 2, 0, 4, 3, 7, 8,
|
||||
2, 7, 1, 6, 5, 0, 8, 3, 4,
|
||||
2, 5, 1, 3, 6, 8, 4, 0, 7,
|
||||
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
1, 6, 2, 0, 5, 4, 3, 7, 8,
|
||||
1, 6, 5, 4, 2, 3, 0, 7, 8,
|
||||
2, 1, 6, 7, 4, 8, 5, 3, 0,
|
||||
2, 1, 6, 5, 8, 4, 3, 0, 7,
|
||||
6, 4, 1, 2, 0, 5, 7, 8, 3,
|
||||
1, 6, 5, 2, 3, 0, 4, 8, 7,
|
||||
6, 1, 4, 0, 2, 7, 5, 3, 8,
|
||||
2, 7, 4, 6, 1, 5, 0, 8, 3,
|
||||
2, 1, 6, 8, 4, 7, 3, 5, 0,
|
||||
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
2, 0, 4, 7, 6, 1, 8, 5, 3,
|
||||
6, 1, 2, 0, 4, 7, 5, 8, 3,
|
||||
2, 7, 8, 0, 1, 6, 4, 3, 5,
|
||||
2, 4, 0, 8, 3, 1, 7, 6, 5,
|
||||
4, 2, 7, 0, 6, 1, 8, 5, 3,
|
||||
2, 1, 0, 8, 5, 6, 7, 4, 3,
|
||||
2, 6, 4, 1, 7, 0, 5, 8, 3,
|
||||
2, 7, 4, 0, 8, 6, 1, 5, 3,
|
||||
2, 8, 7, 4, 1, 0, 3, 6, 5,
|
||||
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
2, 0, 8, 1, 3, 4, 6, 5, 7,
|
||||
1, 2, 0, 6, 8, 5, 7, 3, 4,
|
||||
2, 8, 7, 1, 0, 3, 6, 5, 4,
|
||||
8, 3, 2, 5, 1, 0, 4, 7, 6,
|
||||
2, 0, 4, 8, 5, 1, 7, 6, 3,
|
||||
2, 1, 0, 8, 5, 3, 6, 4, 7,
|
||||
2, 1, 6, 0, 8, 4, 5, 7, 3,
|
||||
2, 7, 8, 4, 0, 6, 1, 5, 3,
|
||||
2, 8, 3, 0, 7, 4, 1, 6, 5,
|
||||
};
|
||||
#endif /* FFMPEG_RV30DATA_H */
|
||||
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* RV30 decoder motion compensation functions
|
||||
* Copyright (c) 2007 Konstantin Shishkov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file rv30dsp.c
|
||||
* RV30 decoder motion compensation functions
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
|
||||
#define RV30_LOWPASS(OPNAME, OP) \
|
||||
static av_unused void OPNAME ## rv30_tpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, const int C1, const int C2){\
|
||||
const int h=8;\
|
||||
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
|
||||
int i;\
|
||||
for(i=0; i<h; i++)\
|
||||
{\
|
||||
OP(dst[0], -(src[-1]+src[2]) + src[0]*C1 + src[1]*C2);\
|
||||
OP(dst[1], -(src[ 0]+src[3]) + src[1]*C1 + src[2]*C2);\
|
||||
OP(dst[2], -(src[ 1]+src[4]) + src[2]*C1 + src[3]*C2);\
|
||||
OP(dst[3], -(src[ 2]+src[5]) + src[3]*C1 + src[4]*C2);\
|
||||
OP(dst[4], -(src[ 3]+src[6]) + src[4]*C1 + src[5]*C2);\
|
||||
OP(dst[5], -(src[ 4]+src[7]) + src[5]*C1 + src[6]*C2);\
|
||||
OP(dst[6], -(src[ 5]+src[8]) + src[6]*C1 + src[7]*C2);\
|
||||
OP(dst[7], -(src[ 6]+src[9]) + src[7]*C1 + src[8]*C2);\
|
||||
dst+=dstStride;\
|
||||
src+=srcStride;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, const int C1, const int C2){\
|
||||
const int w=8;\
|
||||
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
|
||||
int i;\
|
||||
for(i=0; i<w; i++)\
|
||||
{\
|
||||
const int srcA= src[-1*srcStride];\
|
||||
const int src0= src[0 *srcStride];\
|
||||
const int src1= src[1 *srcStride];\
|
||||
const int src2= src[2 *srcStride];\
|
||||
const int src3= src[3 *srcStride];\
|
||||
const int src4= src[4 *srcStride];\
|
||||
const int src5= src[5 *srcStride];\
|
||||
const int src6= src[6 *srcStride];\
|
||||
const int src7= src[7 *srcStride];\
|
||||
const int src8= src[8 *srcStride];\
|
||||
const int src9= src[9 *srcStride];\
|
||||
OP(dst[0*dstStride], -(srcA+src2) + src0*C1 + src1*C2);\
|
||||
OP(dst[1*dstStride], -(src0+src3) + src1*C1 + src2*C2);\
|
||||
OP(dst[2*dstStride], -(src1+src4) + src2*C1 + src3*C2);\
|
||||
OP(dst[3*dstStride], -(src2+src5) + src3*C1 + src4*C2);\
|
||||
OP(dst[4*dstStride], -(src3+src6) + src4*C1 + src5*C2);\
|
||||
OP(dst[5*dstStride], -(src4+src7) + src5*C1 + src6*C2);\
|
||||
OP(dst[6*dstStride], -(src5+src8) + src6*C1 + src7*C2);\
|
||||
OP(dst[7*dstStride], -(src6+src9) + src7*C1 + src8*C2);\
|
||||
dst++;\
|
||||
src++;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel8_h3_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
|
||||
const int h=8+2;\
|
||||
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
|
||||
int i;\
|
||||
for(i=0; i<h; i++)\
|
||||
{\
|
||||
OP(dst[0], 6*src[0]+9*src[1]+src[2]);\
|
||||
OP(dst[1], 6*src[1]+9*src[2]+src[3]);\
|
||||
OP(dst[2], 6*src[2]+9*src[3]+src[4]);\
|
||||
OP(dst[3], 6*src[3]+9*src[4]+src[5]);\
|
||||
OP(dst[4], 6*src[4]+9*src[5]+src[6]);\
|
||||
OP(dst[5], 6*src[5]+9*src[6]+src[7]);\
|
||||
OP(dst[6], 6*src[6]+9*src[7]+src[8]);\
|
||||
OP(dst[7], 6*src[7]+9*src[8]+src[9]);\
|
||||
dst+=dstStride;\
|
||||
src+=srcStride;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel8_v3_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
|
||||
const int w=8;\
|
||||
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
|
||||
int i;\
|
||||
for(i=0; i<w; i++)\
|
||||
{\
|
||||
const int src0= src[0 *srcStride];\
|
||||
const int src1= src[1 *srcStride];\
|
||||
const int src2= src[2 *srcStride];\
|
||||
const int src3= src[3 *srcStride];\
|
||||
const int src4= src[4 *srcStride];\
|
||||
const int src5= src[5 *srcStride];\
|
||||
const int src6= src[6 *srcStride];\
|
||||
const int src7= src[7 *srcStride];\
|
||||
const int src8= src[8 *srcStride];\
|
||||
const int src9= src[9 *srcStride];\
|
||||
OP(dst[0*dstStride], 6*src0 + 9*src1 + src2);\
|
||||
OP(dst[1*dstStride], 6*src1 + 9*src2 + src3);\
|
||||
OP(dst[2*dstStride], 6*src2 + 9*src3 + src4);\
|
||||
OP(dst[3*dstStride], 6*src3 + 9*src4 + src5);\
|
||||
OP(dst[4*dstStride], 6*src4 + 9*src5 + src6);\
|
||||
OP(dst[5*dstStride], 6*src5 + 9*src6 + src7);\
|
||||
OP(dst[6*dstStride], 6*src6 + 9*src7 + src8);\
|
||||
OP(dst[7*dstStride], 6*src7 + 9*src8 + src9);\
|
||||
dst ++;\
|
||||
src ++;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel8_hv_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
|
||||
uint8_t half[8*10];\
|
||||
put_rv30_tpel8_h3_lowpass(half, src, 8, srcStride);\
|
||||
OPNAME ## rv30_tpel8_v3_lowpass(dst, half, dstStride, 8);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel16_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, const int C1, const int C2){\
|
||||
OPNAME ## rv30_tpel8_v_lowpass(dst , src , dstStride, srcStride, C1, C2);\
|
||||
OPNAME ## rv30_tpel8_v_lowpass(dst+8, src+8, dstStride, srcStride, C1, C2);\
|
||||
src += 8*srcStride;\
|
||||
dst += 8*dstStride;\
|
||||
OPNAME ## rv30_tpel8_v_lowpass(dst , src , dstStride, srcStride, C1, C2);\
|
||||
OPNAME ## rv30_tpel8_v_lowpass(dst+8, src+8, dstStride, srcStride, C1, C2);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, const int C1, const int C2){\
|
||||
OPNAME ## rv30_tpel8_h_lowpass(dst , src , dstStride, srcStride, C1, C2);\
|
||||
OPNAME ## rv30_tpel8_h_lowpass(dst+8, src+8, dstStride, srcStride, C1, C2);\
|
||||
src += 8*srcStride;\
|
||||
dst += 8*dstStride;\
|
||||
OPNAME ## rv30_tpel8_h_lowpass(dst , src , dstStride, srcStride, C1, C2);\
|
||||
OPNAME ## rv30_tpel8_h_lowpass(dst+8, src+8, dstStride, srcStride, C1, C2);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel16_hv_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
|
||||
OPNAME ## rv30_tpel8_hv_lowpass(dst , src , dstStride, srcStride);\
|
||||
OPNAME ## rv30_tpel8_hv_lowpass(dst+8, src+8, dstStride, srcStride);\
|
||||
src += 8*srcStride;\
|
||||
dst += 8*dstStride;\
|
||||
OPNAME ## rv30_tpel8_hv_lowpass(dst , src , dstStride, srcStride);\
|
||||
OPNAME ## rv30_tpel8_hv_lowpass(dst+8, src+8, dstStride, srcStride);\
|
||||
}\
|
||||
\
|
||||
|
||||
#define RV30_MC(OPNAME, SIZE) \
|
||||
static void OPNAME ## rv30_tpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
OPNAME ## rv30_tpel ## SIZE ## _h_lowpass(dst, src, stride, stride, 12, 6);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
OPNAME ## rv30_tpel ## SIZE ## _h_lowpass(dst, src, stride, stride, 6, 12);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
OPNAME ## rv30_tpel ## SIZE ## _v_lowpass(dst, src, stride, stride, 12, 6);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
OPNAME ## rv30_tpel ## SIZE ## _v_lowpass(dst, src, stride, stride, 6, 12);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t half[SIZE*SIZE];\
|
||||
put_rv30_tpel ## SIZE ## _h_lowpass(half, src, SIZE, stride, 12, 6);\
|
||||
OPNAME ## rv30_tpel ## SIZE ## _v_lowpass(dst, src, stride, stride, 12, 6);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t half[SIZE*SIZE];\
|
||||
put_rv30_tpel ## SIZE ## _h_lowpass(half, src, SIZE, stride, 12, 6);\
|
||||
OPNAME ## rv30_tpel ## SIZE ## _v_lowpass(dst, src, stride, stride, 6, 12);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
uint8_t half[SIZE*SIZE];\
|
||||
put_rv30_tpel ## SIZE ## _h_lowpass(half, src, SIZE, stride, 6, 12);\
|
||||
OPNAME ## rv30_tpel ## SIZE ## _v_lowpass(dst, src, stride, stride, 12, 6);\
|
||||
}\
|
||||
\
|
||||
static void OPNAME ## rv30_tpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\
|
||||
OPNAME ## rv30_tpel ## SIZE ## _hv_lowpass(dst, src, stride, stride);\
|
||||
}\
|
||||
\
|
||||
|
||||
#define op_avg(a, b) a = (((a)+cm[((b) + 8)>>4]+1)>>1)
|
||||
#define op_put(a, b) a = cm[((b) + 8)>>4]
|
||||
|
||||
RV30_LOWPASS(put_ , op_put)
|
||||
RV30_LOWPASS(avg_ , op_avg)
|
||||
RV30_MC(put_, 8)
|
||||
RV30_MC(put_, 16)
|
||||
RV30_MC(avg_, 8)
|
||||
RV30_MC(avg_, 16)
|
||||
|
||||
void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx) {
|
||||
c->put_rv30_tpel_pixels_tab[0][ 0] = c->put_h264_qpel_pixels_tab[0][0];
|
||||
c->put_rv30_tpel_pixels_tab[0][ 1] = put_rv30_tpel16_mc10_c;
|
||||
c->put_rv30_tpel_pixels_tab[0][ 2] = put_rv30_tpel16_mc20_c;
|
||||
c->put_rv30_tpel_pixels_tab[0][ 4] = put_rv30_tpel16_mc01_c;
|
||||
c->put_rv30_tpel_pixels_tab[0][ 5] = put_rv30_tpel16_mc11_c;
|
||||
c->put_rv30_tpel_pixels_tab[0][ 6] = put_rv30_tpel16_mc21_c;
|
||||
c->put_rv30_tpel_pixels_tab[0][ 8] = put_rv30_tpel16_mc02_c;
|
||||
c->put_rv30_tpel_pixels_tab[0][ 9] = put_rv30_tpel16_mc12_c;
|
||||
c->put_rv30_tpel_pixels_tab[0][10] = put_rv30_tpel16_mc22_c;
|
||||
c->avg_rv30_tpel_pixels_tab[0][ 0] = c->avg_h264_qpel_pixels_tab[0][0];
|
||||
c->avg_rv30_tpel_pixels_tab[0][ 1] = avg_rv30_tpel16_mc10_c;
|
||||
c->avg_rv30_tpel_pixels_tab[0][ 2] = avg_rv30_tpel16_mc20_c;
|
||||
c->avg_rv30_tpel_pixels_tab[0][ 4] = avg_rv30_tpel16_mc01_c;
|
||||
c->avg_rv30_tpel_pixels_tab[0][ 5] = avg_rv30_tpel16_mc11_c;
|
||||
c->avg_rv30_tpel_pixels_tab[0][ 6] = avg_rv30_tpel16_mc21_c;
|
||||
c->avg_rv30_tpel_pixels_tab[0][ 8] = avg_rv30_tpel16_mc02_c;
|
||||
c->avg_rv30_tpel_pixels_tab[0][ 9] = avg_rv30_tpel16_mc12_c;
|
||||
c->avg_rv30_tpel_pixels_tab[0][10] = avg_rv30_tpel16_mc22_c;
|
||||
c->put_rv30_tpel_pixels_tab[1][ 0] = c->put_h264_qpel_pixels_tab[1][0];
|
||||
c->put_rv30_tpel_pixels_tab[1][ 1] = put_rv30_tpel8_mc10_c;
|
||||
c->put_rv30_tpel_pixels_tab[1][ 2] = put_rv30_tpel8_mc20_c;
|
||||
c->put_rv30_tpel_pixels_tab[1][ 4] = put_rv30_tpel8_mc01_c;
|
||||
c->put_rv30_tpel_pixels_tab[1][ 5] = put_rv30_tpel8_mc11_c;
|
||||
c->put_rv30_tpel_pixels_tab[1][ 6] = put_rv30_tpel8_mc21_c;
|
||||
c->put_rv30_tpel_pixels_tab[1][ 8] = put_rv30_tpel8_mc02_c;
|
||||
c->put_rv30_tpel_pixels_tab[1][ 9] = put_rv30_tpel8_mc12_c;
|
||||
c->put_rv30_tpel_pixels_tab[1][10] = put_rv30_tpel8_mc22_c;
|
||||
c->avg_rv30_tpel_pixels_tab[1][ 0] = c->avg_h264_qpel_pixels_tab[1][0];
|
||||
c->avg_rv30_tpel_pixels_tab[1][ 1] = avg_rv30_tpel8_mc10_c;
|
||||
c->avg_rv30_tpel_pixels_tab[1][ 2] = avg_rv30_tpel8_mc20_c;
|
||||
c->avg_rv30_tpel_pixels_tab[1][ 4] = avg_rv30_tpel8_mc01_c;
|
||||
c->avg_rv30_tpel_pixels_tab[1][ 5] = avg_rv30_tpel8_mc11_c;
|
||||
c->avg_rv30_tpel_pixels_tab[1][ 6] = avg_rv30_tpel8_mc21_c;
|
||||
c->avg_rv30_tpel_pixels_tab[1][ 8] = avg_rv30_tpel8_mc02_c;
|
||||
c->avg_rv30_tpel_pixels_tab[1][ 9] = avg_rv30_tpel8_mc12_c;
|
||||
c->avg_rv30_tpel_pixels_tab[1][10] = avg_rv30_tpel8_mc22_c;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* RV30/40 decoder common data declarations
|
||||
* Copyright (c) 2007 Mike Melanson, Konstantin Shishkov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file rv34.h
|
||||
* RV30 and RV40 decoder common data declarations
|
||||
*/
|
||||
|
||||
#ifndef FFMPEG_RV34_H
|
||||
#define FFMPEG_RV34_H
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "mpegvideo.h"
|
||||
|
||||
#include "h264pred.h"
|
||||
|
||||
/**
|
||||
* RV30 and RV40 Macroblock types
|
||||
*/
|
||||
enum RV40BlockTypes{
|
||||
RV34_MB_TYPE_INTRA, ///< Intra macroblock
|
||||
RV34_MB_TYPE_INTRA16x16, ///< Intra macroblock with DCs in a separate 4x4 block
|
||||
RV34_MB_P_16x16, ///< P-frame macroblock, one motion frame
|
||||
RV34_MB_P_8x8, ///< P-frame macroblock, 8x8 motion compensation partitions
|
||||
RV34_MB_B_FORWARD, ///< B-frame macroblock, forward prediction
|
||||
RV34_MB_B_BACKWARD, ///< B-frame macroblock, backward prediction
|
||||
RV34_MB_SKIP, ///< Skipped block
|
||||
RV34_MB_B_DIRECT, ///< Bidirectionally predicted B-frame macroblock, no motion vectors
|
||||
RV34_MB_P_16x8, ///< P-frame macroblock, 16x8 motion compensation partitions
|
||||
RV34_MB_P_8x16, ///< P-frame macroblock, 8x16 motion compensation partitions
|
||||
RV34_MB_B_BIDIR, ///< Bidirectionally predicted B-frame macroblock, two motion vectors
|
||||
RV34_MB_P_MIX16x16, ///< P-frame macroblock with DCs in a separate 4x4 block, one motion vector
|
||||
RV34_MB_TYPES
|
||||
};
|
||||
|
||||
/**
|
||||
* VLC tables used by the decoder
|
||||
*
|
||||
* Intra frame VLC sets do not contain some of those tables.
|
||||
*/
|
||||
typedef struct RV34VLC{
|
||||
VLC cbppattern[2]; ///< VLCs used for pattern of coded block patterns decoding
|
||||
VLC cbp[2][4]; ///< VLCs used for coded block patterns decoding
|
||||
VLC first_pattern[4]; ///< VLCs used for decoding coefficients in the first subblock
|
||||
VLC second_pattern[2]; ///< VLCs used for decoding coefficients in the subblocks 2 and 3
|
||||
VLC third_pattern[2]; ///< VLCs used for decoding coefficients in the last subblock
|
||||
VLC coefficient; ///< VLCs used for decoding big coefficients
|
||||
}RV34VLC;
|
||||
|
||||
/** essential slice information */
|
||||
typedef struct SliceInfo{
|
||||
int type; ///< slice type (intra, inter)
|
||||
int quant; ///< quantizer used for this slice
|
||||
int vlc_set; ///< VLCs used for this slice
|
||||
int start, end; ///< start and end macroblocks of the slice
|
||||
int width; ///< coded width
|
||||
int height; ///< coded height
|
||||
int pts; ///< frame timestamp
|
||||
}SliceInfo;
|
||||
|
||||
/** decoder context */
|
||||
typedef struct RV34DecContext{
|
||||
MpegEncContext s;
|
||||
int8_t *intra_types_hist;///< old block types, used for prediction
|
||||
int8_t *intra_types; ///< block types
|
||||
const uint8_t *luma_dc_quant_i;///< luma subblock DC quantizer for intraframes
|
||||
const uint8_t *luma_dc_quant_p;///< luma subblock DC quantizer for interframes
|
||||
|
||||
RV34VLC *cur_vlcs; ///< VLC set used for current frame decoding
|
||||
int bits; ///< slice size in bits
|
||||
H264PredContext h; ///< functions for 4x4 and 16x16 intra block prediction
|
||||
SliceInfo si; ///< current slice information
|
||||
|
||||
int *mb_type; ///< internal macroblock types
|
||||
int block_type; ///< current block type
|
||||
int luma_vlc; ///< which VLC set will be used for decoding of luma blocks
|
||||
int chroma_vlc; ///< which VLC set will be used for decoding of chroma blocks
|
||||
int is16; ///< current block has additional 16x16 specific features or not
|
||||
int dmv[4][2]; ///< differential motion vectors for the current macroblock
|
||||
|
||||
int rv30; ///< indicates which RV variasnt is currently decoded
|
||||
int rpr; ///< one field size in RV30 slice header
|
||||
|
||||
int cur_pts, last_pts, next_pts;
|
||||
|
||||
uint16_t *cbp_luma; ///< CBP values for luma subblocks
|
||||
uint8_t *cbp_chroma; ///< CBP values for chroma subblocks
|
||||
|
||||
/** 8x8 block available flags (for MV prediction) */
|
||||
DECLARE_ALIGNED_8(uint32_t, avail_cache[3*4]);
|
||||
|
||||
int (*parse_slice_header)(struct RV34DecContext *r, GetBitContext *gb, SliceInfo *si);
|
||||
int (*decode_mb_info)(struct RV34DecContext *r);
|
||||
int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst);
|
||||
void (*loop_filter)(struct RV34DecContext *r);
|
||||
}RV34DecContext;
|
||||
|
||||
/**
|
||||
* common decoding functions
|
||||
*/
|
||||
int ff_rv34_get_start_offset(GetBitContext *gb, int blocks);
|
||||
int ff_rv34_decode_init(AVCodecContext *avctx);
|
||||
int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size);
|
||||
int ff_rv34_decode_end(AVCodecContext *avctx);
|
||||
|
||||
#endif /* FFMPEG_RV34_H */
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* RealVideo 4 decoder
|
||||
* copyright (c) 2007 Konstantin Shishkov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file rv34data.h
|
||||
* miscellaneous RV30/40 tables
|
||||
*/
|
||||
|
||||
#ifndef FFMPEG_RV34DATA_H
|
||||
#define FFMPEG_RV34DATA_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* number of ones in nibble minus one
|
||||
*/
|
||||
static const uint8_t rv34_count_ones[16] = {
|
||||
0, 0, 0, 1, 0, 1, 1, 2, 0, 1, 1, 2, 1, 2, 2, 3
|
||||
};
|
||||
|
||||
/**
|
||||
* values used to reconstruct coded block pattern
|
||||
*/
|
||||
static const uint8_t rv34_cbp_code[16] = {
|
||||
0x00, 0x20, 0x10, 0x30, 0x02, 0x22, 0x12, 0x32,
|
||||
0x01, 0x21, 0x11, 0x31, 0x03, 0x23, 0x13, 0x33
|
||||
};
|
||||
|
||||
/**
|
||||
* precalculated results of division by three and modulo three for values 0-107
|
||||
*
|
||||
* A lot of four-tuples in RV40 are represented as c0*27+c1*9+c2*3+c3.
|
||||
* This table allows conversion from a value back to a vector.
|
||||
*/
|
||||
static const uint8_t modulo_three_table[108][4] = {
|
||||
{ 0, 0, 0, 0 }, { 0, 0, 0, 1 }, { 0, 0, 0, 2 }, { 0, 0, 1, 0 },
|
||||
{ 0, 0, 1, 1 }, { 0, 0, 1, 2 }, { 0, 0, 2, 0 }, { 0, 0, 2, 1 },
|
||||
{ 0, 0, 2, 2 }, { 0, 1, 0, 0 }, { 0, 1, 0, 1 }, { 0, 1, 0, 2 },
|
||||
{ 0, 1, 1, 0 }, { 0, 1, 1, 1 }, { 0, 1, 1, 2 }, { 0, 1, 2, 0 },
|
||||
{ 0, 1, 2, 1 }, { 0, 1, 2, 2 }, { 0, 2, 0, 0 }, { 0, 2, 0, 1 },
|
||||
{ 0, 2, 0, 2 }, { 0, 2, 1, 0 }, { 0, 2, 1, 1 }, { 0, 2, 1, 2 },
|
||||
{ 0, 2, 2, 0 }, { 0, 2, 2, 1 }, { 0, 2, 2, 2 }, { 1, 0, 0, 0 },
|
||||
{ 1, 0, 0, 1 }, { 1, 0, 0, 2 }, { 1, 0, 1, 0 }, { 1, 0, 1, 1 },
|
||||
{ 1, 0, 1, 2 }, { 1, 0, 2, 0 }, { 1, 0, 2, 1 }, { 1, 0, 2, 2 },
|
||||
{ 1, 1, 0, 0 }, { 1, 1, 0, 1 }, { 1, 1, 0, 2 }, { 1, 1, 1, 0 },
|
||||
{ 1, 1, 1, 1 }, { 1, 1, 1, 2 }, { 1, 1, 2, 0 }, { 1, 1, 2, 1 },
|
||||
{ 1, 1, 2, 2 }, { 1, 2, 0, 0 }, { 1, 2, 0, 1 }, { 1, 2, 0, 2 },
|
||||
{ 1, 2, 1, 0 }, { 1, 2, 1, 1 }, { 1, 2, 1, 2 }, { 1, 2, 2, 0 },
|
||||
{ 1, 2, 2, 1 }, { 1, 2, 2, 2 }, { 2, 0, 0, 0 }, { 2, 0, 0, 1 },
|
||||
{ 2, 0, 0, 2 }, { 2, 0, 1, 0 }, { 2, 0, 1, 1 }, { 2, 0, 1, 2 },
|
||||
{ 2, 0, 2, 0 }, { 2, 0, 2, 1 }, { 2, 0, 2, 2 }, { 2, 1, 0, 0 },
|
||||
{ 2, 1, 0, 1 }, { 2, 1, 0, 2 }, { 2, 1, 1, 0 }, { 2, 1, 1, 1 },
|
||||
{ 2, 1, 1, 2 }, { 2, 1, 2, 0 }, { 2, 1, 2, 1 }, { 2, 1, 2, 2 },
|
||||
{ 2, 2, 0, 0 }, { 2, 2, 0, 1 }, { 2, 2, 0, 2 }, { 2, 2, 1, 0 },
|
||||
{ 2, 2, 1, 1 }, { 2, 2, 1, 2 }, { 2, 2, 2, 0 }, { 2, 2, 2, 1 },
|
||||
{ 2, 2, 2, 2 }, { 3, 0, 0, 0 }, { 3, 0, 0, 1 }, { 3, 0, 0, 2 },
|
||||
{ 3, 0, 1, 0 }, { 3, 0, 1, 1 }, { 3, 0, 1, 2 }, { 3, 0, 2, 0 },
|
||||
{ 3, 0, 2, 1 }, { 3, 0, 2, 2 }, { 3, 1, 0, 0 }, { 3, 1, 0, 1 },
|
||||
{ 3, 1, 0, 2 }, { 3, 1, 1, 0 }, { 3, 1, 1, 1 }, { 3, 1, 1, 2 },
|
||||
{ 3, 1, 2, 0 }, { 3, 1, 2, 1 }, { 3, 1, 2, 2 }, { 3, 2, 0, 0 },
|
||||
{ 3, 2, 0, 1 }, { 3, 2, 0, 2 }, { 3, 2, 1, 0 }, { 3, 2, 1, 1 },
|
||||
{ 3, 2, 1, 2 }, { 3, 2, 2, 0 }, { 3, 2, 2, 1 }, { 3, 2, 2, 2 },
|
||||
};
|
||||
|
||||
/**
|
||||
* quantizer values used for AC and DC coefficients in chroma blocks
|
||||
*/
|
||||
static const uint8_t rv34_chroma_quant[2][32] = {
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23, 23, 24, 24, 25, 25 },
|
||||
{ 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
|
||||
14, 15, 15, 16, 17, 18, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23 }
|
||||
};
|
||||
|
||||
/**
|
||||
* This table is used for dequantizing.
|
||||
*/
|
||||
static const uint16_t rv34_qscale_tab[32] = {
|
||||
60, 67, 76, 85, 96, 108, 121, 136,
|
||||
152, 171, 192, 216, 242, 272, 305, 341,
|
||||
383, 432, 481, 544, 606, 683, 767, 854,
|
||||
963, 1074, 1212, 1392, 1566, 1708, 1978, 2211
|
||||
};
|
||||
|
||||
/**
|
||||
* 4x4 dezigzag pattern
|
||||
*/
|
||||
static const uint8_t rv34_dezigzag[16] = {
|
||||
0, 1, 8, 16,
|
||||
9, 2, 3, 10,
|
||||
17, 24, 25, 18,
|
||||
11, 19, 26, 27
|
||||
};
|
||||
|
||||
/**
|
||||
* tables used to translate a quantizer value into a VLC set for decoding
|
||||
* The first table is used for intraframes.
|
||||
*/
|
||||
static const uint8_t rv34_quant_to_vlc_set[2][31] = {
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
|
||||
2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3,
|
||||
3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 },
|
||||
};
|
||||
|
||||
/**
|
||||
* table for obtaining the quantizer difference
|
||||
* @todo Use with modified_quant_tab from h263data.h.
|
||||
*/
|
||||
static const uint8_t rv34_dquant_tab[2][32]={
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
||||
{
|
||||
0, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28
|
||||
},{
|
||||
0, 2, 3, 4, 5, 6, 7, 8, 9,10,11,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,31,31,26
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* maximum number of macroblocks for each of the possible slice offset sizes
|
||||
* @todo This is the same as ff_mba_max, maybe use it instead.
|
||||
*/
|
||||
static const uint16_t rv34_mb_max_sizes[6] = { 0x2F, 0x68, 0x18B, 0x62F, 0x18BF, 0x23FF };
|
||||
/**
|
||||
* bits needed to code the slice offset for the given size
|
||||
* @todo This is the same as ff_mba_length, maybe use it instead.
|
||||
*/
|
||||
static const uint8_t rv34_mb_bits_sizes[6] = { 6, 7, 9, 11, 13, 14 };
|
||||
|
||||
#endif /* FFMPEG_RV34DATA_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
* RV40 decoder
|
||||
* Copyright (c) 2007 Konstantin Shishkov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file rv40.c
|
||||
* RV40 decoder
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "mpegvideo.h"
|
||||
#include "golomb.h"
|
||||
|
||||
#include "rv34.h"
|
||||
#include "rv40vlc2.h"
|
||||
#include "rv40data.h"
|
||||
|
||||
static VLC aic_top_vlc;
|
||||
static VLC aic_mode1_vlc[AIC_MODE1_NUM], aic_mode2_vlc[AIC_MODE2_NUM];
|
||||
static VLC ptype_vlc[NUM_PTYPE_VLCS], btype_vlc[NUM_BTYPE_VLCS];
|
||||
|
||||
/**
|
||||
* Initialize all tables.
|
||||
*/
|
||||
static av_cold void rv40_init_tables()
|
||||
{
|
||||
int i;
|
||||
|
||||
init_vlc(&aic_top_vlc, AIC_TOP_BITS, AIC_TOP_SIZE,
|
||||
rv40_aic_top_vlc_bits, 1, 1,
|
||||
rv40_aic_top_vlc_codes, 1, 1, INIT_VLC_USE_STATIC);
|
||||
for(i = 0; i < AIC_MODE1_NUM; i++){
|
||||
// Every tenth VLC table is empty
|
||||
if((i % 10) == 9) continue;
|
||||
init_vlc(&aic_mode1_vlc[i], AIC_MODE1_BITS, AIC_MODE1_SIZE,
|
||||
aic_mode1_vlc_bits[i], 1, 1,
|
||||
aic_mode1_vlc_codes[i], 1, 1, INIT_VLC_USE_STATIC);
|
||||
}
|
||||
for(i = 0; i < AIC_MODE2_NUM; i++){
|
||||
init_vlc(&aic_mode2_vlc[i], AIC_MODE2_BITS, AIC_MODE2_SIZE,
|
||||
aic_mode2_vlc_bits[i], 1, 1,
|
||||
aic_mode2_vlc_codes[i], 2, 2, INIT_VLC_USE_STATIC);
|
||||
}
|
||||
for(i = 0; i < NUM_PTYPE_VLCS; i++)
|
||||
init_vlc_sparse(&ptype_vlc[i], PTYPE_VLC_BITS, PTYPE_VLC_SIZE,
|
||||
ptype_vlc_bits[i], 1, 1,
|
||||
ptype_vlc_codes[i], 1, 1,
|
||||
ptype_vlc_syms, 1, 1, INIT_VLC_USE_STATIC);
|
||||
for(i = 0; i < NUM_BTYPE_VLCS; i++)
|
||||
init_vlc_sparse(&btype_vlc[i], BTYPE_VLC_BITS, BTYPE_VLC_SIZE,
|
||||
btype_vlc_bits[i], 1, 1,
|
||||
btype_vlc_codes[i], 1, 1,
|
||||
btype_vlc_syms, 1, 1, INIT_VLC_USE_STATIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get stored dimension from bitstream.
|
||||
*
|
||||
* If the width/height is the standard one then it's coded as a 3-bit index.
|
||||
* Otherwise it is coded as escaped 8-bit portions.
|
||||
*/
|
||||
static int get_dimension(GetBitContext *gb, const int *dim)
|
||||
{
|
||||
int t = get_bits(gb, 3);
|
||||
int val = dim[t];
|
||||
if(val < 0)
|
||||
val = dim[get_bits1(gb) - val];
|
||||
if(!val){
|
||||
do{
|
||||
t = get_bits(gb, 8);
|
||||
val += t << 2;
|
||||
}while(t == 0xFF);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get encoded picture size - usually this is called from rv40_parse_slice_header.
|
||||
*/
|
||||
static void rv40_parse_picture_size(GetBitContext *gb, int *w, int *h)
|
||||
{
|
||||
*w = get_dimension(gb, rv40_standard_widths);
|
||||
*h = get_dimension(gb, rv40_standard_heights);
|
||||
}
|
||||
|
||||
static int rv40_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceInfo *si)
|
||||
{
|
||||
int mb_bits;
|
||||
int w = r->s.width, h = r->s.height;
|
||||
int mb_size;
|
||||
|
||||
memset(si, 0, sizeof(SliceInfo));
|
||||
if(get_bits1(gb))
|
||||
return -1;
|
||||
si->type = get_bits(gb, 2);
|
||||
if(si->type == 1) si->type = 0;
|
||||
si->quant = get_bits(gb, 5);
|
||||
if(get_bits(gb, 2))
|
||||
return -1;
|
||||
si->vlc_set = get_bits(gb, 2);
|
||||
skip_bits1(gb);
|
||||
si->pts = get_bits(gb, 13);
|
||||
if(!si->type || !get_bits1(gb))
|
||||
rv40_parse_picture_size(gb, &w, &h);
|
||||
if(avcodec_check_dimensions(r->s.avctx, w, h) < 0)
|
||||
return -1;
|
||||
si->width = w;
|
||||
si->height = h;
|
||||
mb_size = ((w + 15) >> 4) * ((h + 15) >> 4);
|
||||
mb_bits = ff_rv34_get_start_offset(gb, mb_size);
|
||||
si->start = get_bits(gb, mb_bits);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode 4x4 intra types array.
|
||||
*/
|
||||
static int rv40_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t *dst)
|
||||
{
|
||||
MpegEncContext *s = &r->s;
|
||||
int i, j, k, v;
|
||||
int A, B, C;
|
||||
int pattern;
|
||||
int8_t *ptr;
|
||||
|
||||
for(i = 0; i < 4; i++, dst += s->b4_stride){
|
||||
if(!i && s->first_slice_line){
|
||||
pattern = get_vlc2(gb, aic_top_vlc.table, AIC_TOP_BITS, 1);
|
||||
dst[0] = (pattern >> 2) & 2;
|
||||
dst[1] = (pattern >> 1) & 2;
|
||||
dst[2] = pattern & 2;
|
||||
dst[3] = (pattern << 1) & 2;
|
||||
continue;
|
||||
}
|
||||
ptr = dst;
|
||||
for(j = 0; j < 4; j++){
|
||||
/* Coefficients are read using VLC chosen by the prediction pattern
|
||||
* The first one (used for retrieving a pair of coefficients) is
|
||||
* constructed from the top, top right and left coefficients
|
||||
* The second one (used for retrieving only one coefficient) is
|
||||
* top + 10 * left.
|
||||
*/
|
||||
A = ptr[-s->b4_stride + 1]; // it won't be used for the last coefficient in a row
|
||||
B = ptr[-s->b4_stride];
|
||||
C = ptr[-1];
|
||||
pattern = A + (B << 4) + (C << 8);
|
||||
for(k = 0; k < MODE2_PATTERNS_NUM; k++)
|
||||
if(pattern == rv40_aic_table_index[k])
|
||||
break;
|
||||
if(j < 3 && k < MODE2_PATTERNS_NUM){ //pattern is found, decoding 2 coefficients
|
||||
v = get_vlc2(gb, aic_mode2_vlc[k].table, AIC_MODE2_BITS, 2);
|
||||
*ptr++ = v/9;
|
||||
*ptr++ = v%9;
|
||||
j++;
|
||||
}else{
|
||||
if(B != -1 && C != -1)
|
||||
v = get_vlc2(gb, aic_mode1_vlc[B + C*10].table, AIC_MODE1_BITS, 1);
|
||||
else{ // tricky decoding
|
||||
v = 0;
|
||||
switch(C){
|
||||
case -1: // code 0 -> 1, 1 -> 0
|
||||
if(B < 2)
|
||||
v = get_bits1(gb) ^ 1;
|
||||
break;
|
||||
case 0:
|
||||
case 2: // code 0 -> 2, 1 -> 0
|
||||
v = (get_bits1(gb) ^ 1) << 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*ptr++ = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode macroblock information.
|
||||
*/
|
||||
static int rv40_decode_mb_info(RV34DecContext *r)
|
||||
{
|
||||
MpegEncContext *s = &r->s;
|
||||
GetBitContext *gb = &s->gb;
|
||||
int q, i;
|
||||
int prev_type = 0;
|
||||
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
|
||||
int blocks[RV34_MB_TYPES] = {0};
|
||||
int count = 0;
|
||||
|
||||
if(!r->s.mb_skip_run)
|
||||
r->s.mb_skip_run = svq3_get_ue_golomb(gb) + 1;
|
||||
|
||||
if(--r->s.mb_skip_run)
|
||||
return RV34_MB_SKIP;
|
||||
|
||||
if(r->avail_cache[5-1])
|
||||
blocks[r->mb_type[mb_pos - 1]]++;
|
||||
if(r->avail_cache[5-4]){
|
||||
blocks[r->mb_type[mb_pos - s->mb_stride]]++;
|
||||
if(r->avail_cache[5-2])
|
||||
blocks[r->mb_type[mb_pos - s->mb_stride + 1]]++;
|
||||
if(r->avail_cache[5-5])
|
||||
blocks[r->mb_type[mb_pos - s->mb_stride - 1]]++;
|
||||
}
|
||||
|
||||
for(i = 0; i < RV34_MB_TYPES; i++){
|
||||
if(blocks[i] > count){
|
||||
count = blocks[i];
|
||||
prev_type = i;
|
||||
}
|
||||
}
|
||||
if(s->pict_type == FF_P_TYPE){
|
||||
prev_type = block_num_to_ptype_vlc_num[prev_type];
|
||||
q = get_vlc2(gb, ptype_vlc[prev_type].table, PTYPE_VLC_BITS, 1);
|
||||
if(q < PBTYPE_ESCAPE)
|
||||
return q;
|
||||
q = get_vlc2(gb, ptype_vlc[prev_type].table, PTYPE_VLC_BITS, 1);
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Dquant for P-frame\n");
|
||||
}else{
|
||||
prev_type = block_num_to_btype_vlc_num[prev_type];
|
||||
q = get_vlc2(gb, btype_vlc[prev_type].table, BTYPE_VLC_BITS, 1);
|
||||
if(q < PBTYPE_ESCAPE)
|
||||
return q;
|
||||
q = get_vlc2(gb, btype_vlc[prev_type].table, BTYPE_VLC_BITS, 1);
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Dquant for B-frame\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize decoder.
|
||||
*/
|
||||
static av_cold int rv40_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
RV34DecContext *r = avctx->priv_data;
|
||||
|
||||
r->rv30 = 0;
|
||||
ff_rv34_decode_init(avctx);
|
||||
if(!aic_top_vlc.bits)
|
||||
rv40_init_tables();
|
||||
r->parse_slice_header = rv40_parse_slice_header;
|
||||
r->decode_intra_types = rv40_decode_intra_types;
|
||||
r->decode_mb_info = rv40_decode_mb_info;
|
||||
r->luma_dc_quant_i = rv40_luma_dc_quant[0];
|
||||
r->luma_dc_quant_p = rv40_luma_dc_quant[1];
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodec rv40_decoder = {
|
||||
"rv40",
|
||||
CODEC_TYPE_VIDEO,
|
||||
CODEC_ID_RV40,
|
||||
sizeof(RV34DecContext),
|
||||
rv40_decode_init,
|
||||
NULL,
|
||||
ff_rv34_decode_end,
|
||||
ff_rv34_decode_frame,
|
||||
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("RealVideo 4.0"),
|
||||
};
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* RealVideo 4 decoder
|
||||
* copyright (c) 2007 Konstantin Shishkov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file rv40data.h
|
||||
* miscellaneous RV40 tables
|
||||
*/
|
||||
|
||||
#ifndef FFMPEG_RV40DATA_H
|
||||
#define FFMPEG_RV40DATA_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* standard widths and heights coded in RV40
|
||||
*/
|
||||
//@{
|
||||
static const int rv40_standard_widths[] = { 160, 172, 240, 320, 352, 640, 704, 0};
|
||||
static const int rv40_standard_heights[] = { 120, 132, 144, 240, 288, 480, -8, -10, 180, 360, 576, 0};
|
||||
//@}
|
||||
|
||||
#define MODE2_PATTERNS_NUM 20
|
||||
/**
|
||||
* intra types table
|
||||
*
|
||||
* These values are actually coded 3-tuples
|
||||
* used for detecting standard block configurations.
|
||||
*/
|
||||
static const uint16_t rv40_aic_table_index[MODE2_PATTERNS_NUM] = {
|
||||
0x000, 0x100, 0x200,
|
||||
0x011, 0x111, 0x211, 0x511, 0x611,
|
||||
0x022, 0x122, 0x222, 0x722,
|
||||
0x272, 0x227,
|
||||
0x822, 0x282, 0x228,
|
||||
0x112, 0x116, 0x221
|
||||
};
|
||||
|
||||
/**
|
||||
* luma quantizer values
|
||||
* The second table is used for inter blocks.
|
||||
*/
|
||||
static const uint8_t rv40_luma_dc_quant[2][32] = {
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 22, 22, 22, 22 },
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 20, 21, 21, 22, 23, 23, 23, 24, 24, 24, 24 }
|
||||
};
|
||||
|
||||
/**
|
||||
* @begingroup loopfilter coefficients used by the RV40 loop filter
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* dither values for deblocking filter - left/top values
|
||||
*/
|
||||
static const uint8_t rv40_dither_l[16] = {
|
||||
0x40, 0x50, 0x20, 0x60, 0x30, 0x50, 0x40, 0x30,
|
||||
0x50, 0x40, 0x50, 0x30, 0x60, 0x20, 0x50, 0x40
|
||||
};
|
||||
/**
|
||||
* dither values for deblocking filter - right/bottom values
|
||||
*/
|
||||
static const uint8_t rv40_dither_r[16] = {
|
||||
0x40, 0x30, 0x60, 0x20, 0x50, 0x30, 0x30, 0x40,
|
||||
0x40, 0x40, 0x50, 0x30, 0x20, 0x60, 0x30, 0x40
|
||||
};
|
||||
|
||||
/** alpha parameter for RV40 loop filter - almost the same as in JVT-A003r1 */
|
||||
static const uint8_t rv40_alpha_tab[32] = {
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 122, 96, 75, 59, 47, 37,
|
||||
29, 23, 18, 15, 13, 11, 10, 9,
|
||||
8, 7, 6, 5, 4, 3, 2, 1
|
||||
};
|
||||
/** beta parameter for RV40 loop filter - almost the same as in JVT-A003r1 */
|
||||
static const uint8_t rv40_beta_tab[32] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 4, 4, 6, 6,
|
||||
6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14, 15, 16, 17
|
||||
};
|
||||
/** clip table for RV40 loop filter - the same as in JVT-A003r1 */
|
||||
static const uint8_t rv40_filter_clip_tbl[3][32] = {
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
},
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 5, 5
|
||||
},
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 7, 8, 9
|
||||
}
|
||||
};
|
||||
/** @} */ // end loopfilter group
|
||||
|
||||
#endif /* FFMPEG_RV40DATA_H */
|
||||
@@ -0,0 +1,706 @@
|
||||
/*
|
||||
* RealVideo 4 decoder
|
||||
* copyright (c) 2007 Konstantin Shishkov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file rv40vlc2.h
|
||||
* RV40 VLC tables used for macroblock information decoding
|
||||
*/
|
||||
|
||||
#ifndef FFMPEG_RV40VLC2_H
|
||||
#define FFMPEG_RV40VLC2_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* codes used for the first four block types
|
||||
*/
|
||||
//@{
|
||||
#define AIC_TOP_BITS 8
|
||||
#define AIC_TOP_SIZE 16
|
||||
static const uint8_t rv40_aic_top_vlc_codes[AIC_TOP_SIZE] = {
|
||||
0x01, 0x05, 0x01, 0x00, 0x03, 0x3D, 0x1D, 0x02,
|
||||
0x04, 0x3C, 0x3F, 0x1C, 0x0D, 0x3E, 0x0C, 0x01
|
||||
};
|
||||
|
||||
static const uint8_t rv40_aic_top_vlc_bits[AIC_TOP_SIZE] = {
|
||||
1, 4, 5, 5, 5, 7, 6, 5, 4, 7, 7, 6, 5, 7, 5, 3
|
||||
};
|
||||
//@}
|
||||
|
||||
/**
|
||||
* codes used for determining a pair of block types
|
||||
*/
|
||||
//@{
|
||||
#define AIC_MODE2_NUM 20
|
||||
#define AIC_MODE2_SIZE 81
|
||||
#define AIC_MODE2_BITS 9
|
||||
|
||||
static const uint16_t aic_mode2_vlc_codes[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
|
||||
{ 0x0001, 0x0001, 0x0005, 0x01F5, 0x0011, 0x0049, 0x0000, 0x0048, 0x004B,
|
||||
0x0035, 0x0003, 0x0034, 0x03C9, 0x01F4, 0x00C9, 0x004A, 0x0FD9, 0x03C8,
|
||||
0x0010, 0x0037, 0x0001, 0x00C8, 0x0075, 0x01F7, 0x00CB, 0x0074, 0x0002,
|
||||
0x01F6, 0x00CA, 0x01F1, 0x01F0, 0x1F81, 0x07F9, 0x1F80, 0x1F83, 0x07F8,
|
||||
0x0077, 0x00F5, 0x0036, 0x07FB, 0x0076, 0x1F82, 0x00F4, 0x00F7, 0x07FA,
|
||||
0x0071, 0x00F6, 0x03CB, 0x03CA, 0x0FD8, 0x00F1, 0x03F5, 0x1F8D, 0x07E5,
|
||||
0x0013, 0x0031, 0x00F0, 0x0FDB, 0x00F3, 0x07E4, 0x0030, 0x01F3, 0x07E7,
|
||||
0x03F4, 0x07E6, 0x0070, 0x3F19, 0x01F2, 0x3F18, 0x0FDA, 0x0033, 0x07E1,
|
||||
0x01FD, 0x01FC, 0x0073, 0x01FF, 0x0FC5, 0x0FC4, 0x0FC7, 0x03F7, 0x0072, },
|
||||
{ 0x0005, 0x0005, 0x0005, 0x0079, 0x0005, 0x000D, 0x001D, 0x0078, 0x0069,
|
||||
0x0004, 0x0001, 0x0007, 0x0068, 0x001C, 0x001F, 0x0004, 0x006B, 0x000C,
|
||||
0x0004, 0x001E, 0x0006, 0x006A, 0x0015, 0x000F, 0x0014, 0x0017, 0x0007,
|
||||
0x0016, 0x000E, 0x0011, 0x0009, 0x00D1, 0x00D0, 0x0181, 0x00D3, 0x007B,
|
||||
0x0010, 0x0013, 0x0004, 0x00D2, 0x0007, 0x0319, 0x0008, 0x007A, 0x00DD,
|
||||
0x0019, 0x0006, 0x000B, 0x0065, 0x00DC, 0x0012, 0x0064, 0x0180, 0x00DF,
|
||||
0x0006, 0x0018, 0x0001, 0x00DE, 0x001D, 0x00D9, 0x001B, 0x0067, 0x000A,
|
||||
0x00D8, 0x00DB, 0x001C, 0x0318, 0x00DA, 0x0635, 0x0183, 0x0000, 0x00C5,
|
||||
0x0066, 0x0061, 0x0035, 0x00C4, 0x0182, 0x0634, 0x031B, 0x00C7, 0x001F, },
|
||||
{ 0x0005, 0x0001, 0x001D, 0x01C1, 0x0035, 0x00F1, 0x006D, 0x00F0, 0x0049,
|
||||
0x0000, 0x0004, 0x0003, 0x00F3, 0x0048, 0x0034, 0x006C, 0x01C0, 0x01C3,
|
||||
0x0007, 0x0006, 0x0001, 0x006F, 0x0002, 0x004B, 0x006E, 0x001C, 0x0005,
|
||||
0x0069, 0x0068, 0x006B, 0x0037, 0x01C2, 0x00F2, 0x0395, 0x01CD, 0x00FD,
|
||||
0x006A, 0x0036, 0x0015, 0x01CC, 0x0014, 0x0394, 0x004A, 0x00FC, 0x00FF,
|
||||
0x0017, 0x0031, 0x00FE, 0x01CF, 0x0397, 0x00F9, 0x01CE, 0x0725, 0x0396,
|
||||
0x0016, 0x0030, 0x0075, 0x0724, 0x00F8, 0x0727, 0x0033, 0x0391, 0x0390,
|
||||
0x0011, 0x0032, 0x001F, 0x00FB, 0x0074, 0x0726, 0x00FA, 0x001E, 0x0077,
|
||||
0x0019, 0x0018, 0x0004, 0x0010, 0x003D, 0x0076, 0x0071, 0x0013, 0x0001, },
|
||||
{ 0x000D, 0x0019, 0x0011, 0x0015, 0x0061, 0x0019, 0x0014, 0x01AD, 0x0060,
|
||||
0x0018, 0x0001, 0x0005, 0x001B, 0x0010, 0x0019, 0x0005, 0x0017, 0x0018,
|
||||
0x0016, 0x0004, 0x0004, 0x0013, 0x000C, 0x0012, 0x001A, 0x0018, 0x0005,
|
||||
0x000F, 0x001B, 0x0004, 0x001D, 0x0011, 0x001C, 0x0010, 0x000E, 0x001B,
|
||||
0x0013, 0x001F, 0x001A, 0x0029, 0x0005, 0x0063, 0x001E, 0x0009, 0x0062,
|
||||
0x0008, 0x0007, 0x0007, 0x0019, 0x0004, 0x001A, 0x0018, 0x006D, 0x0007,
|
||||
0x001B, 0x0007, 0x001A, 0x006C, 0x0006, 0x0012, 0x0005, 0x006F, 0x000B,
|
||||
0x006E, 0x0069, 0x001D, 0x0359, 0x0028, 0x002B, 0x002A, 0x001C, 0x00D5,
|
||||
0x0358, 0x001F, 0x0001, 0x001E, 0x0068, 0x00D4, 0x00D7, 0x0019, 0x0000, },
|
||||
{ 0x00B9, 0x0061, 0x0060, 0x00B8, 0x02B5, 0x01AD, 0x00BB, 0x0AF5, 0x0151,
|
||||
0x0001, 0x0001, 0x0005, 0x0000, 0x0003, 0x0005, 0x0004, 0x0063, 0x0025,
|
||||
0x00BA, 0x0004, 0x0007, 0x0062, 0x00A5, 0x0024, 0x006D, 0x0002, 0x006C,
|
||||
0x02B4, 0x000D, 0x006F, 0x0027, 0x00A4, 0x0026, 0x01AC, 0x0150, 0x01AF,
|
||||
0x01AE, 0x0021, 0x006E, 0x02B7, 0x0020, 0x0153, 0x0023, 0x00A7, 0x0152,
|
||||
0x00A6, 0x0006, 0x000C, 0x0022, 0x01A9, 0x0019, 0x002D, 0x02B6, 0x01A8,
|
||||
0x000F, 0x0007, 0x000E, 0x00A1, 0x0069, 0x002C, 0x0001, 0x01AB, 0x00A0,
|
||||
0x02B1, 0x00A3, 0x002F, 0x0AF4, 0x02B0, 0x0AF7, 0x02B3, 0x0068, 0x015D,
|
||||
0x0AF6, 0x01AA, 0x0055, 0x015C, 0x02B2, 0x0579, 0x0578, 0x015F, 0x00A2, },
|
||||
{ 0x0905, 0x013D, 0x013C, 0x0904, 0x121D, 0x049D, 0x049C, 0x243D, 0x0907,
|
||||
0x00ED, 0x0001, 0x0015, 0x0041, 0x013F, 0x0031, 0x0014, 0x025D, 0x025C,
|
||||
0x013E, 0x000D, 0x0000, 0x0040, 0x0139, 0x0043, 0x0030, 0x0017, 0x0033,
|
||||
0x0906, 0x0032, 0x0042, 0x00EC, 0x025F, 0x00EF, 0x025E, 0x049F, 0x0138,
|
||||
0x0901, 0x013B, 0x0259, 0x121C, 0x049E, 0x0900, 0x0258, 0x243C, 0x121F,
|
||||
0x0903, 0x003D, 0x00EE, 0x025B, 0x025A, 0x004D, 0x013A, 0x0902, 0x0245,
|
||||
0x00E9, 0x0016, 0x00E8, 0x0499, 0x0125, 0x0244, 0x004C, 0x0498, 0x090D,
|
||||
0x00EB, 0x003C, 0x0011, 0x049B, 0x049A, 0x0485, 0x00EA, 0x003F, 0x0124,
|
||||
0x090C, 0x003E, 0x0039, 0x0095, 0x0247, 0x0246, 0x0484, 0x0094, 0x0038, },
|
||||
{ 0x0F09, 0x00CD, 0x01FD, 0x0791, 0x1E6D, 0x0790, 0x03D9, 0x3CD1, 0x3CD0,
|
||||
0x0075, 0x0001, 0x0001, 0x0035, 0x00CC, 0x0011, 0x0000, 0x03D8, 0x01FC,
|
||||
0x03DB, 0x0010, 0x0003, 0x00CF, 0x03DA, 0x00CE, 0x0074, 0x0034, 0x0077,
|
||||
0x0793, 0x0013, 0x0076, 0x0071, 0x03C5, 0x0070, 0x01FF, 0x0792, 0x01FE,
|
||||
0x01F9, 0x0037, 0x00C9, 0x0F08, 0x01F8, 0x03C4, 0x00C8, 0x0F0B, 0x079D,
|
||||
0x03C7, 0x0001, 0x0012, 0x0073, 0x00CB, 0x0005, 0x0036, 0x03C6, 0x0072,
|
||||
0x007D, 0x0002, 0x00CA, 0x079C, 0x01FB, 0x00F5, 0x0031, 0x079F, 0x0F0A,
|
||||
0x0F35, 0x079E, 0x01FA, 0x1E6C, 0x1E6F, 0x3CD3, 0x0799, 0x03C1, 0x1E6E,
|
||||
0x3CD2, 0x0030, 0x00F4, 0x007C, 0x03C0, 0x03C3, 0x0798, 0x01E5, 0x00F7, },
|
||||
{ 0x01A5, 0x0001, 0x001D, 0x0021, 0x00A1, 0x000D, 0x0061, 0x06B9, 0x00A0,
|
||||
0x0060, 0x0001, 0x0005, 0x000C, 0x0020, 0x001C, 0x0004, 0x01A4, 0x01A7,
|
||||
0x00A3, 0x001F, 0x001E, 0x0023, 0x0022, 0x002D, 0x002C, 0x0063, 0x0062,
|
||||
0x1A81, 0x01A6, 0x01A1, 0x06B8, 0x06BB, 0x00A2, 0x06BA, 0x0D59, 0x06A5,
|
||||
0x01A0, 0x000F, 0x006D, 0x06A4, 0x002F, 0x00AD, 0x006C, 0x06A7, 0x00AC,
|
||||
0x0D58, 0x000E, 0x01A3, 0x00AF, 0x00AE, 0x006F, 0x01A2, 0x0D5B, 0x00A9,
|
||||
0x0019, 0x0001, 0x0009, 0x00A8, 0x006E, 0x002E, 0x0000, 0x01AD, 0x00AB,
|
||||
0x00AA, 0x0355, 0x0029, 0x1A80, 0x1A83, 0x1A82, 0x0354, 0x01AC, 0x0D5A,
|
||||
0x1A8D, 0x01AF, 0x0357, 0x0D45, 0x0D44, 0x0D47, 0x1A8C, 0x06A6, 0x06A1, },
|
||||
{ 0x0001, 0x0011, 0x0005, 0x0775, 0x00F9, 0x00F8, 0x0031, 0x0030, 0x0049,
|
||||
0x00FB, 0x0010, 0x0033, 0x0EC9, 0x038D, 0x038C, 0x00FA, 0x038F, 0x0774,
|
||||
0x0048, 0x0032, 0x0000, 0x01D5, 0x00E5, 0x038E, 0x00E4, 0x0013, 0x000D,
|
||||
0x0389, 0x0777, 0x0388, 0x038B, 0x1DF9, 0x0EC8, 0x3BC9, 0x1DF8, 0x038A,
|
||||
0x03B5, 0x0776, 0x00E7, 0x3BC8, 0x01D4, 0x3BCB, 0x0ECB, 0x0771, 0x0ECA,
|
||||
0x01D7, 0x03B4, 0x01D6, 0x1DFB, 0x0EF5, 0x0770, 0x0EF4, 0x3BCA, 0x0773,
|
||||
0x00E6, 0x03B7, 0x004B, 0x1DFA, 0x03B6, 0x0EF7, 0x00E1, 0x0EF6, 0x0EF1,
|
||||
0x03B1, 0x01D1, 0x003D, 0x0EF0, 0x0772, 0x077D, 0x077C, 0x003C, 0x01D0,
|
||||
0x03B0, 0x01D3, 0x003F, 0x03B3, 0x01D2, 0x0EF3, 0x077F, 0x00E0, 0x004A, },
|
||||
{ 0x0015, 0x0049, 0x0014, 0x07D1, 0x03FD, 0x03FC, 0x01C1, 0x01C0, 0x00F1,
|
||||
0x0017, 0x0001, 0x0001, 0x01C3, 0x0048, 0x004B, 0x0016, 0x0031, 0x01C2,
|
||||
0x004A, 0x0011, 0x0000, 0x01CD, 0x00F0, 0x01CC, 0x0075, 0x0010, 0x000D,
|
||||
0x03FF, 0x01CF, 0x01CE, 0x07D0, 0x0F81, 0x07D3, 0x1F1D, 0x0F80, 0x07D2,
|
||||
0x01C9, 0x03FE, 0x0074, 0x07DD, 0x00F3, 0x1F1C, 0x07DC, 0x03F9, 0x07DF,
|
||||
0x00F2, 0x00FD, 0x0077, 0x07DE, 0x07D9, 0x01C8, 0x07D8, 0x0F83, 0x03F8,
|
||||
0x0030, 0x0076, 0x0013, 0x0F82, 0x00FC, 0x03FB, 0x0033, 0x03FA, 0x03E5,
|
||||
0x03E4, 0x01CB, 0x0032, 0x1F1F, 0x03E7, 0x07DB, 0x07DA, 0x003D, 0x01CA,
|
||||
0x07C5, 0x03E6, 0x0071, 0x0F8D, 0x07C4, 0x1F1E, 0x0F8C, 0x03E1, 0x01F5, },
|
||||
{ 0x0019, 0x0065, 0x0018, 0x0351, 0x0350, 0x0353, 0x0021, 0x0020, 0x0064,
|
||||
0x001D, 0x0005, 0x0005, 0x01A5, 0x0023, 0x0067, 0x0005, 0x0066, 0x0022,
|
||||
0x001B, 0x0004, 0x0001, 0x0004, 0x001C, 0x0061, 0x001A, 0x0005, 0x0004,
|
||||
0x0007, 0x002D, 0x0006, 0x002C, 0x01A4, 0x002F, 0x0352, 0x035D, 0x0060,
|
||||
0x0001, 0x002E, 0x001F, 0x035C, 0x0000, 0x06B1, 0x01A7, 0x0029, 0x01A6,
|
||||
0x0028, 0x0063, 0x0062, 0x035F, 0x01A1, 0x002B, 0x06B0, 0x06B3, 0x01A0,
|
||||
0x0003, 0x006D, 0x001E, 0x035E, 0x006C, 0x06B2, 0x0002, 0x01A3, 0x01A2,
|
||||
0x000D, 0x0005, 0x0007, 0x01AD, 0x006F, 0x002A, 0x006E, 0x0004, 0x0004,
|
||||
0x000C, 0x0007, 0x0006, 0x000F, 0x000E, 0x00D5, 0x0009, 0x0006, 0x0007, },
|
||||
{ 0x0065, 0x0181, 0x0064, 0x36C9, 0x06D5, 0x0DB5, 0x0379, 0x0180, 0x0183,
|
||||
0x00D5, 0x001D, 0x001C, 0x0DB4, 0x0182, 0x0378, 0x00D4, 0x00D7, 0x06D4,
|
||||
0x0067, 0x001F, 0x0001, 0x00D6, 0x00D1, 0x018D, 0x0066, 0x0001, 0x0000,
|
||||
0x037B, 0x06D7, 0x037A, 0x0DB7, 0x36C8, 0x06D6, 0x0DB6, 0x1B79, 0x0DB1,
|
||||
0x018C, 0x0365, 0x00D0, 0x1B78, 0x00D3, 0x1B7B, 0x0364, 0x06D1, 0x06D0,
|
||||
0x018F, 0x018E, 0x00D2, 0x36CB, 0x0367, 0x0366, 0x06D3, 0x0DB0, 0x06D2,
|
||||
0x0361, 0x06DD, 0x0189, 0x36CA, 0x0360, 0x36F5, 0x0188, 0x0DB3, 0x36F4,
|
||||
0x0009, 0x0008, 0x0005, 0x06DC, 0x00DD, 0x018B, 0x00DC, 0x0004, 0x000B,
|
||||
0x018A, 0x0061, 0x0003, 0x0363, 0x00DF, 0x06DF, 0x0362, 0x000A, 0x001E, },
|
||||
{ 0x001D, 0x0061, 0x000D, 0x0D55, 0x06B9, 0x06B8, 0x01A5, 0x0021, 0x0020,
|
||||
0x0023, 0x000C, 0x0060, 0x0D54, 0x00AD, 0x00AC, 0x0022, 0x00AF, 0x06BB,
|
||||
0x000F, 0x001C, 0x0001, 0x002D, 0x0063, 0x01A4, 0x000E, 0x0001, 0x0005,
|
||||
0x01A7, 0x06BA, 0x01A6, 0x06A5, 0x0D57, 0x0D56, 0x1ABD, 0x0D51, 0x00AE,
|
||||
0x002C, 0x00A9, 0x002F, 0x0D50, 0x01A1, 0x1ABC, 0x06A4, 0x06A7, 0x06A6,
|
||||
0x00A8, 0x06A1, 0x01A0, 0x1ABF, 0x0D53, 0x06A0, 0x0D52, 0x1ABE, 0x06A3,
|
||||
0x0062, 0x002E, 0x0009, 0x0D5D, 0x01A3, 0x0D5C, 0x006D, 0x00AB, 0x06A2,
|
||||
0x006C, 0x001F, 0x0001, 0x06AD, 0x0029, 0x01A2, 0x0028, 0x0004, 0x001E,
|
||||
0x01AD, 0x006F, 0x0000, 0x01AC, 0x01AF, 0x06AC, 0x00AA, 0x006E, 0x0019, },
|
||||
{ 0x0019, 0x007D, 0x0018, 0x01B5, 0x000D, 0x01B4, 0x007C, 0x007F, 0x01B7,
|
||||
0x000C, 0x001B, 0x001A, 0x01B6, 0x000F, 0x00D5, 0x0019, 0x007E, 0x00D4,
|
||||
0x0018, 0x001B, 0x0001, 0x000E, 0x0011, 0x0009, 0x0005, 0x0005, 0x0005,
|
||||
0x00D7, 0x01B1, 0x0008, 0x01B0, 0x0079, 0x06FD, 0x0371, 0x0370, 0x00D6,
|
||||
0x0078, 0x01B3, 0x0010, 0x0373, 0x0013, 0x06FC, 0x007B, 0x007A, 0x00D1,
|
||||
0x00D0, 0x00D3, 0x0065, 0x0372, 0x06FF, 0x0064, 0x06FE, 0x037D, 0x00D2,
|
||||
0x00DD, 0x0067, 0x0004, 0x037C, 0x0012, 0x01B2, 0x0007, 0x0066, 0x01BD,
|
||||
0x0006, 0x0061, 0x0004, 0x01BC, 0x001A, 0x0060, 0x001D, 0x0004, 0x001C,
|
||||
0x0063, 0x0001, 0x0007, 0x000B, 0x0000, 0x0062, 0x000A, 0x0005, 0x0007, },
|
||||
{ 0x0069, 0x0045, 0x0068, 0x04BD, 0x0255, 0x04BC, 0x00E5, 0x00E4, 0x0031,
|
||||
0x0030, 0x0019, 0x0001, 0x0121, 0x00E7, 0x00E6, 0x0033, 0x00E1, 0x00E0,
|
||||
0x006B, 0x0018, 0x0001, 0x0044, 0x0032, 0x0047, 0x006A, 0x001B, 0x0005,
|
||||
0x003D, 0x0046, 0x0015, 0x0041, 0x0120, 0x0123, 0x04BF, 0x0122, 0x0040,
|
||||
0x003C, 0x00E3, 0x0014, 0x0254, 0x0043, 0x0975, 0x012D, 0x00E2, 0x00ED,
|
||||
0x0042, 0x00EC, 0x004D, 0x0257, 0x0256, 0x0251, 0x04BE, 0x0974, 0x0250,
|
||||
0x00EF, 0x00EE, 0x004C, 0x04B9, 0x012C, 0x04B8, 0x004F, 0x04BB, 0x0253,
|
||||
0x003F, 0x0017, 0x0001, 0x0252, 0x00E9, 0x00E8, 0x00EB, 0x0000, 0x0003,
|
||||
0x0016, 0x0002, 0x0004, 0x004E, 0x003E, 0x00EA, 0x0049, 0x000D, 0x0007, },
|
||||
{ 0x000D, 0x01BD, 0x000C, 0x0D31, 0x0D30, 0x0D33, 0x0359, 0x0358, 0x002D,
|
||||
0x0065, 0x001D, 0x001C, 0x0D32, 0x035B, 0x035A, 0x002C, 0x01BC, 0x0345,
|
||||
0x000F, 0x001F, 0x0001, 0x002F, 0x0064, 0x01BF, 0x0067, 0x0001, 0x0005,
|
||||
0x0066, 0x002E, 0x0061, 0x0029, 0x0695, 0x0694, 0x0697, 0x0696, 0x0060,
|
||||
0x01BE, 0x0D3D, 0x0028, 0x1A49, 0x0344, 0x1A48, 0x1A4B, 0x0D3C, 0x0691,
|
||||
0x002B, 0x01B9, 0x002A, 0x0D3F, 0x0690, 0x0347, 0x0D3E, 0x1A4A, 0x0346,
|
||||
0x00D5, 0x0341, 0x0063, 0x0D39, 0x0340, 0x0D38, 0x01B8, 0x0D3B, 0x0D3A,
|
||||
0x00D4, 0x0062, 0x0000, 0x0693, 0x01BB, 0x0343, 0x0342, 0x001E, 0x000E,
|
||||
0x006D, 0x0009, 0x0001, 0x006C, 0x00D7, 0x034D, 0x01BA, 0x0008, 0x0004, },
|
||||
{ 0x0075, 0x00CD, 0x0035, 0x03C1, 0x03C0, 0x07F9, 0x03C3, 0x1F8D, 0x00CC,
|
||||
0x0074, 0x0011, 0x0010, 0x03C2, 0x0FD9, 0x01F1, 0x00CF, 0x03CD, 0x00CE,
|
||||
0x0034, 0x0001, 0x0001, 0x0037, 0x00C9, 0x00C8, 0x0036, 0x0000, 0x0001,
|
||||
0x0FD8, 0x03CC, 0x00CB, 0x01F0, 0x07F8, 0x03CF, 0x07FB, 0x07FA, 0x00CA,
|
||||
0x01F3, 0x03CE, 0x00F5, 0x0FDB, 0x00F4, 0x07E5, 0x07E4, 0x07E7, 0x01F2,
|
||||
0x07E6, 0x03C9, 0x01FD, 0x0FDA, 0x1F8C, 0x07E1, 0x1F8F, 0x1F8E, 0x03C8,
|
||||
0x03CB, 0x0077, 0x0076, 0x0FC5, 0x03CA, 0x07E0, 0x00F7, 0x0FC4, 0x03F5,
|
||||
0x00F6, 0x01FC, 0x0003, 0x03F4, 0x0071, 0x03F7, 0x00F1, 0x0013, 0x0031,
|
||||
0x0030, 0x0070, 0x0005, 0x0012, 0x0073, 0x01FF, 0x0072, 0x007D, 0x0002, },
|
||||
{ 0x0061, 0x0055, 0x0060, 0x02C9, 0x02C8, 0x02CB, 0x0171, 0x00B5, 0x0054,
|
||||
0x0001, 0x0001, 0x0001, 0x0057, 0x0001, 0x0063, 0x001D, 0x0062, 0x0039,
|
||||
0x006D, 0x0000, 0x0005, 0x0038, 0x0056, 0x00B4, 0x006C, 0x0003, 0x001C,
|
||||
0x006F, 0x003B, 0x0002, 0x003A, 0x0170, 0x00B7, 0x0173, 0x0051, 0x006E,
|
||||
0x0025, 0x0050, 0x0069, 0x02CA, 0x0024, 0x0027, 0x0172, 0x00B6, 0x00B1,
|
||||
0x000D, 0x000C, 0x001F, 0x017D, 0x0026, 0x0068, 0x0053, 0x017C, 0x006B,
|
||||
0x001E, 0x000F, 0x0004, 0x017F, 0x006A, 0x02F5, 0x0019, 0x0021, 0x0052,
|
||||
0x02F4, 0x02F7, 0x0020, 0x0BCD, 0x05E5, 0x05E4, 0x0BCC, 0x0023, 0x00B0,
|
||||
0x02F6, 0x00B3, 0x0022, 0x02F1, 0x02F0, 0x0BCF, 0x0BCE, 0x017E, 0x005D, },
|
||||
{ 0x00BD, 0x0025, 0x01A1, 0x0159, 0x0299, 0x00BC, 0x0024, 0x0505, 0x0504,
|
||||
0x01A0, 0x0001, 0x001D, 0x006D, 0x001C, 0x0001, 0x0005, 0x0027, 0x01A3,
|
||||
0x0158, 0x001F, 0x001E, 0x01A2, 0x0026, 0x0021, 0x000D, 0x0020, 0x0023,
|
||||
0x0298, 0x006C, 0x0022, 0x00BF, 0x00BE, 0x01AD, 0x002D, 0x029B, 0x00B9,
|
||||
0x01AC, 0x00B8, 0x01AF, 0x029A, 0x006F, 0x015B, 0x006E, 0x0285, 0x0284,
|
||||
0x01AE, 0x0019, 0x002C, 0x01A9, 0x01A8, 0x000C, 0x000F, 0x015A, 0x00BB,
|
||||
0x000E, 0x0000, 0x0069, 0x01AB, 0x0018, 0x01AA, 0x0004, 0x0055, 0x00BA,
|
||||
0x0507, 0x0145, 0x0054, 0x0506, 0x00A5, 0x0501, 0x00A4, 0x0057, 0x0500,
|
||||
0x0A05, 0x0144, 0x00A7, 0x0287, 0x0286, 0x0503, 0x0147, 0x0A04, 0x0146, },
|
||||
{ 0x0759, 0x0041, 0x00E5, 0x03BD, 0x0E9D, 0x012D, 0x012C, 0x3A1D, 0x03BC,
|
||||
0x012F, 0x000D, 0x0040, 0x00E4, 0x03BF, 0x0043, 0x0042, 0x0758, 0x03BE,
|
||||
0x00E7, 0x0001, 0x0000, 0x003D, 0x00E6, 0x0015, 0x0014, 0x0017, 0x003C,
|
||||
0x743D, 0x012E, 0x03B9, 0x03B8, 0x0E9C, 0x03BB, 0x075B, 0x3A1C, 0x0E9F,
|
||||
0x0129, 0x00E1, 0x0128, 0x0E9E, 0x012B, 0x075A, 0x00E0, 0x0E99, 0x0745,
|
||||
0x3A1F, 0x03BA, 0x0744, 0x0E98, 0x1D0D, 0x03A5, 0x0E9B, 0x743C, 0x0E9A,
|
||||
0x012A, 0x004D, 0x00E3, 0x0E85, 0x01D5, 0x0E84, 0x004C, 0x0747, 0x1D0C,
|
||||
0x01D4, 0x003F, 0x0016, 0x0746, 0x03A4, 0x0741, 0x004F, 0x003E, 0x01D7,
|
||||
0x0740, 0x000C, 0x0011, 0x004E, 0x00E2, 0x00ED, 0x00EC, 0x0049, 0x0048, },
|
||||
};
|
||||
|
||||
static const uint8_t aic_mode2_vlc_bits[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
|
||||
{ 1, 5, 4, 10, 6, 8, 5, 8, 8,
|
||||
7, 5, 7, 11, 10, 9, 8, 13, 11,
|
||||
6, 7, 3, 9, 8, 10, 9, 8, 5,
|
||||
10, 9, 10, 10, 14, 12, 14, 14, 12,
|
||||
8, 9, 7, 12, 8, 14, 9, 9, 12,
|
||||
8, 9, 11, 11, 13, 9, 11, 14, 12,
|
||||
6, 7, 9, 13, 9, 12, 7, 10, 12,
|
||||
11, 12, 8, 15, 10, 15, 13, 7, 12,
|
||||
10, 10, 8, 10, 13, 13, 13, 11, 8, },
|
||||
{ 4, 6, 5, 11, 8, 10, 7, 11, 9,
|
||||
4, 1, 4, 9, 7, 7, 5, 9, 10,
|
||||
6, 7, 4, 9, 9, 10, 9, 9, 6,
|
||||
9, 10, 9, 10, 12, 12, 13, 12, 11,
|
||||
9, 9, 8, 12, 8, 14, 10, 11, 12,
|
||||
7, 8, 10, 11, 12, 9, 11, 13, 12,
|
||||
6, 7, 8, 12, 9, 12, 7, 11, 10,
|
||||
12, 12, 9, 14, 12, 15, 13, 8, 12,
|
||||
11, 11, 10, 12, 13, 15, 14, 12, 9, },
|
||||
{ 5, 7, 6, 12, 9, 11, 8, 11, 10,
|
||||
7, 5, 7, 11, 10, 9, 8, 12, 12,
|
||||
5, 5, 1, 8, 7, 10, 8, 6, 4,
|
||||
8, 8, 8, 9, 12, 11, 13, 12, 11,
|
||||
8, 9, 8, 12, 8, 13, 10, 11, 11,
|
||||
8, 9, 11, 12, 13, 11, 12, 14, 13,
|
||||
8, 9, 10, 14, 11, 14, 9, 13, 13,
|
||||
8, 9, 6, 11, 10, 14, 11, 6, 10,
|
||||
6, 6, 4, 8, 9, 10, 10, 8, 5, },
|
||||
{ 11, 7, 8, 10, 12, 9, 10, 14, 12,
|
||||
7, 1, 5, 7, 8, 6, 4, 10, 9,
|
||||
10, 5, 4, 8, 11, 8, 7, 6, 7,
|
||||
11, 6, 7, 8, 10, 8, 10, 11, 9,
|
||||
10, 8, 9, 13, 9, 12, 8, 11, 12,
|
||||
11, 4, 7, 8, 9, 6, 8, 12, 9,
|
||||
8, 5, 8, 12, 9, 10, 6, 12, 11,
|
||||
12, 12, 10, 15, 13, 13, 13, 10, 13,
|
||||
15, 10, 9, 10, 12, 13, 13, 10, 9, },
|
||||
{ 11, 8, 8, 11, 13, 10, 11, 15, 12,
|
||||
7, 1, 4, 7, 7, 5, 4, 8, 9,
|
||||
11, 5, 5, 8, 11, 9, 8, 7, 8,
|
||||
13, 7, 8, 9, 11, 9, 10, 12, 10,
|
||||
10, 9, 8, 13, 9, 12, 9, 11, 12,
|
||||
11, 5, 7, 9, 10, 6, 9, 13, 10,
|
||||
7, 4, 7, 11, 8, 9, 5, 10, 11,
|
||||
13, 11, 9, 15, 13, 15, 13, 8, 12,
|
||||
15, 10, 10, 12, 13, 14, 14, 12, 11, },
|
||||
{ 12, 9, 9, 12, 13, 11, 11, 14, 12,
|
||||
8, 2, 5, 7, 9, 6, 5, 10, 10,
|
||||
9, 4, 2, 7, 9, 7, 6, 5, 6,
|
||||
12, 6, 7, 8, 10, 8, 10, 11, 9,
|
||||
12, 9, 10, 13, 11, 12, 10, 14, 13,
|
||||
12, 6, 8, 10, 10, 7, 9, 12, 10,
|
||||
8, 5, 8, 11, 9, 10, 7, 11, 12,
|
||||
8, 6, 5, 11, 11, 11, 8, 6, 9,
|
||||
12, 6, 6, 8, 10, 10, 11, 8, 6, },
|
||||
{ 13, 9, 10, 12, 14, 12, 11, 15, 15,
|
||||
8, 1, 5, 7, 9, 6, 5, 11, 10,
|
||||
11, 6, 5, 9, 11, 9, 8, 7, 8,
|
||||
12, 6, 8, 8, 11, 8, 10, 12, 10,
|
||||
10, 7, 9, 13, 10, 11, 9, 13, 12,
|
||||
11, 3, 6, 8, 9, 4, 7, 11, 8,
|
||||
8, 5, 9, 12, 10, 9, 7, 12, 13,
|
||||
13, 12, 10, 14, 14, 15, 12, 11, 14,
|
||||
15, 7, 9, 8, 11, 11, 12, 10, 9, },
|
||||
{ 10, 5, 6, 9, 11, 7, 8, 12, 11,
|
||||
8, 1, 4, 7, 9, 6, 4, 10, 10,
|
||||
11, 6, 6, 9, 9, 9, 9, 8, 8,
|
||||
14, 10, 10, 12, 12, 11, 12, 13, 12,
|
||||
10, 7, 8, 12, 9, 11, 8, 12, 11,
|
||||
13, 7, 10, 11, 11, 8, 10, 13, 11,
|
||||
6, 3, 7, 11, 8, 9, 5, 10, 11,
|
||||
11, 11, 9, 14, 14, 14, 11, 10, 13,
|
||||
14, 10, 11, 13, 13, 13, 14, 12, 12, },
|
||||
{ 2, 5, 3, 11, 8, 8, 6, 6, 7,
|
||||
8, 5, 6, 12, 10, 10, 8, 10, 11,
|
||||
7, 6, 2, 9, 8, 10, 8, 5, 4,
|
||||
10, 11, 10, 10, 13, 12, 14, 13, 10,
|
||||
10, 11, 8, 14, 9, 14, 12, 11, 12,
|
||||
9, 10, 9, 13, 12, 11, 12, 14, 11,
|
||||
8, 10, 7, 13, 10, 12, 8, 12, 12,
|
||||
10, 9, 6, 12, 11, 11, 11, 6, 9,
|
||||
10, 9, 6, 10, 9, 12, 11, 8, 7, },
|
||||
{ 6, 8, 6, 12, 11, 11, 10, 10, 9,
|
||||
6, 1, 3, 10, 8, 8, 6, 7, 10,
|
||||
8, 6, 3, 10, 9, 10, 8, 6, 5,
|
||||
11, 10, 10, 12, 13, 12, 14, 13, 12,
|
||||
10, 11, 8, 12, 9, 14, 12, 11, 12,
|
||||
9, 9, 8, 12, 12, 10, 12, 13, 11,
|
||||
7, 8, 6, 13, 9, 11, 7, 11, 11,
|
||||
11, 10, 7, 14, 11, 12, 12, 7, 10,
|
||||
12, 11, 8, 13, 12, 14, 13, 11, 10, },
|
||||
{ 7, 10, 7, 13, 13, 13, 11, 11, 10,
|
||||
8, 5, 6, 12, 11, 10, 9, 10, 11,
|
||||
7, 5, 1, 9, 8, 10, 7, 4, 4,
|
||||
9, 11, 9, 11, 12, 11, 13, 13, 10,
|
||||
9, 11, 8, 13, 9, 14, 12, 11, 12,
|
||||
11, 10, 10, 13, 12, 11, 14, 14, 12,
|
||||
9, 10, 8, 13, 10, 14, 9, 12, 12,
|
||||
9, 7, 4, 12, 10, 11, 10, 6, 7,
|
||||
9, 7, 4, 9, 9, 11, 9, 7, 5, },
|
||||
{ 7, 9, 7, 14, 11, 12, 10, 9, 9,
|
||||
8, 5, 5, 12, 9, 10, 8, 8, 11,
|
||||
7, 5, 2, 8, 8, 9, 7, 4, 4,
|
||||
10, 11, 10, 12, 14, 11, 12, 13, 12,
|
||||
9, 10, 8, 13, 8, 13, 10, 11, 11,
|
||||
9, 9, 8, 14, 10, 10, 11, 12, 11,
|
||||
10, 11, 9, 14, 10, 14, 9, 12, 14,
|
||||
6, 6, 3, 11, 8, 9, 8, 3, 6,
|
||||
9, 7, 4, 10, 8, 11, 10, 6, 5, },
|
||||
{ 6, 8, 7, 13, 12, 12, 10, 9, 9,
|
||||
9, 7, 8, 13, 11, 11, 9, 11, 12,
|
||||
7, 6, 1, 9, 8, 10, 7, 5, 4,
|
||||
10, 12, 10, 12, 13, 13, 14, 13, 11,
|
||||
9, 11, 9, 13, 10, 14, 12, 12, 12,
|
||||
11, 12, 10, 14, 13, 12, 13, 14, 12,
|
||||
8, 9, 7, 13, 10, 13, 8, 11, 12,
|
||||
8, 6, 3, 12, 9, 10, 9, 4, 6,
|
||||
10, 8, 5, 10, 10, 12, 11, 8, 6, },
|
||||
{ 7, 10, 7, 12, 9, 12, 10, 10, 12,
|
||||
9, 7, 7, 12, 9, 11, 6, 10, 11,
|
||||
6, 6, 1, 9, 8, 9, 7, 4, 5,
|
||||
11, 12, 9, 12, 10, 14, 13, 13, 11,
|
||||
10, 12, 8, 13, 8, 14, 10, 10, 11,
|
||||
11, 11, 10, 13, 14, 10, 14, 13, 11,
|
||||
11, 10, 7, 13, 8, 12, 7, 10, 12,
|
||||
7, 10, 4, 12, 6, 10, 8, 5, 8,
|
||||
10, 7, 4, 9, 7, 10, 9, 6, 5, },
|
||||
{ 7, 9, 7, 13, 12, 13, 10, 10, 8,
|
||||
8, 5, 6, 11, 10, 10, 8, 10, 10,
|
||||
7, 5, 2, 9, 8, 9, 7, 5, 3,
|
||||
8, 9, 7, 9, 11, 11, 13, 11, 9,
|
||||
8, 10, 7, 12, 9, 14, 11, 10, 10,
|
||||
9, 10, 9, 12, 12, 12, 13, 14, 12,
|
||||
10, 10, 9, 13, 11, 13, 9, 13, 12,
|
||||
8, 7, 4, 12, 10, 10, 10, 6, 6,
|
||||
7, 6, 3, 9, 8, 10, 9, 6, 3, },
|
||||
{ 7, 10, 7, 13, 13, 13, 11, 11, 9,
|
||||
8, 6, 6, 13, 11, 11, 9, 10, 11,
|
||||
7, 6, 1, 9, 8, 10, 8, 5, 4,
|
||||
8, 9, 8, 9, 12, 12, 12, 12, 8,
|
||||
10, 13, 9, 14, 11, 14, 14, 13, 12,
|
||||
9, 10, 9, 13, 12, 11, 13, 14, 11,
|
||||
9, 11, 8, 13, 11, 13, 10, 13, 13,
|
||||
9, 8, 5, 12, 10, 11, 11, 6, 7,
|
||||
8, 7, 3, 8, 9, 11, 10, 7, 4, },
|
||||
{ 8, 9, 7, 11, 11, 12, 11, 14, 9,
|
||||
8, 6, 6, 11, 13, 10, 9, 11, 9,
|
||||
7, 5, 1, 7, 9, 9, 7, 5, 3,
|
||||
13, 11, 9, 10, 12, 11, 12, 12, 9,
|
||||
10, 11, 9, 13, 9, 12, 12, 12, 10,
|
||||
12, 11, 10, 13, 14, 12, 14, 14, 11,
|
||||
11, 8, 8, 13, 11, 12, 9, 13, 11,
|
||||
9, 10, 5, 11, 8, 11, 9, 6, 7,
|
||||
7, 8, 4, 6, 8, 10, 8, 8, 5, },
|
||||
{ 8, 10, 8, 13, 13, 13, 12, 11, 10,
|
||||
5, 1, 3, 10, 7, 8, 6, 8, 9,
|
||||
8, 7, 4, 9, 10, 11, 8, 7, 6,
|
||||
8, 9, 7, 9, 12, 11, 12, 10, 8,
|
||||
9, 10, 8, 13, 9, 9, 12, 11, 11,
|
||||
7, 7, 6, 12, 9, 8, 10, 12, 8,
|
||||
6, 7, 4, 12, 8, 13, 6, 9, 10,
|
||||
13, 13, 9, 15, 14, 14, 15, 9, 11,
|
||||
13, 11, 9, 13, 13, 15, 15, 12, 10, },
|
||||
{ 10, 8, 9, 11, 12, 10, 8, 13, 13,
|
||||
9, 2, 5, 7, 5, 4, 3, 8, 9,
|
||||
11, 5, 5, 9, 8, 8, 6, 8, 8,
|
||||
12, 7, 8, 10, 10, 9, 8, 12, 10,
|
||||
9, 10, 9, 12, 7, 11, 7, 12, 12,
|
||||
9, 5, 8, 9, 9, 6, 6, 11, 10,
|
||||
6, 4, 7, 9, 5, 9, 3, 9, 10,
|
||||
13, 11, 9, 13, 10, 13, 10, 9, 13,
|
||||
14, 11, 10, 12, 12, 13, 11, 14, 11, },
|
||||
{ 11, 7, 8, 10, 12, 9, 9, 14, 10,
|
||||
9, 4, 7, 8, 10, 7, 7, 11, 10,
|
||||
8, 2, 2, 6, 8, 5, 5, 5, 6,
|
||||
15, 9, 10, 10, 12, 10, 11, 14, 12,
|
||||
9, 8, 9, 12, 9, 11, 8, 12, 11,
|
||||
14, 10, 11, 12, 13, 10, 12, 15, 12,
|
||||
9, 7, 8, 12, 9, 12, 7, 11, 13,
|
||||
9, 6, 5, 11, 10, 11, 7, 6, 9,
|
||||
11, 4, 5, 7, 8, 8, 8, 7, 7, },
|
||||
};
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Codes used for determining block type
|
||||
*/
|
||||
//@{
|
||||
#define AIC_MODE1_NUM 90
|
||||
#define AIC_MODE1_SIZE 9
|
||||
#define AIC_MODE1_BITS 7
|
||||
|
||||
static const uint8_t aic_mode1_vlc_codes[AIC_MODE1_NUM][AIC_MODE1_SIZE] = {
|
||||
{ 0x01, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x10, 0x05,},
|
||||
{ 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
|
||||
{ 0x01, 0x01, 0x01, 0x11, 0x09, 0x10, 0x05, 0x00, 0x03,},
|
||||
{ 0x01, 0x01, 0x00, 0x03, 0x21, 0x05, 0x09, 0x20, 0x11,},
|
||||
{ 0x01, 0x09, 0x00, 0x29, 0x08, 0x15, 0x03, 0x0B, 0x28,},
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
|
||||
{ 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x01, 0x09, 0x08,},
|
||||
{ 0x01, 0x01, 0x01, 0x09, 0x01, 0x08, 0x00, 0x03, 0x05,},
|
||||
{ 0x01, 0x01, 0x01, 0x00, 0x05, 0x11, 0x09, 0x10, 0x03,},
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
|
||||
|
||||
{ 0x01, 0x01, 0x01, 0x05, 0x01, 0x00, 0x03, 0x09, 0x08,},
|
||||
{ 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
|
||||
{ 0x01, 0x01, 0x01, 0x0D, 0x05, 0x04, 0x00, 0x07, 0x0C,},
|
||||
{ 0x01, 0x01, 0x00, 0x05, 0x11, 0x03, 0x09, 0x21, 0x20,},
|
||||
{ 0x05, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x21, 0x20,},
|
||||
{ 0x09, 0x01, 0x01, 0x00, 0x05, 0x01, 0x03, 0x11, 0x10,},
|
||||
{ 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x03, 0x02,},
|
||||
{ 0x01, 0x01, 0x01, 0x09, 0x00, 0x05, 0x01, 0x03, 0x08,},
|
||||
{ 0x01, 0x01, 0x01, 0x09, 0x11, 0x05, 0x00, 0x10, 0x03,},
|
||||
{ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
|
||||
|
||||
{ 0x01, 0x00, 0x01, 0x09, 0x08, 0x15, 0x14, 0x0B, 0x03,},
|
||||
{ 0x0D, 0x01, 0x01, 0x05, 0x0C, 0x04, 0x01, 0x00, 0x07,},
|
||||
{ 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x03, 0x01, 0x01,},
|
||||
{ 0x05, 0x01, 0x01, 0x04, 0x19, 0x07, 0x18, 0x0D, 0x00,},
|
||||
{ 0x11, 0x09, 0x01, 0x21, 0x05, 0x20, 0x01, 0x00, 0x03,},
|
||||
{ 0x41, 0x01, 0x00, 0x05, 0x40, 0x03, 0x09, 0x21, 0x11,},
|
||||
{ 0x29, 0x01, 0x00, 0x28, 0x09, 0x15, 0x03, 0x08, 0x0B,},
|
||||
{ 0x01, 0x00, 0x01, 0x11, 0x09, 0x10, 0x05, 0x01, 0x03,},
|
||||
{ 0x05, 0x01, 0x01, 0x04, 0x0D, 0x0C, 0x07, 0x00, 0x01,},
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
|
||||
|
||||
{ 0x01, 0x00, 0x03, 0x05, 0x11, 0x10, 0x25, 0x24, 0x13,},
|
||||
{ 0x21, 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x20, 0x09,},
|
||||
{ 0x01, 0x01, 0x01, 0x00, 0x09, 0x11, 0x10, 0x05, 0x03,},
|
||||
{ 0x21, 0x05, 0x01, 0x01, 0x09, 0x00, 0x11, 0x20, 0x03,},
|
||||
{ 0x05, 0x01, 0x00, 0x04, 0x01, 0x19, 0x07, 0x18, 0x0D,},
|
||||
{ 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x03, 0x10, 0x05,},
|
||||
{ 0x1D, 0x01, 0x05, 0x0D, 0x0C, 0x04, 0x00, 0x1C, 0x0F,},
|
||||
{ 0x05, 0x19, 0x01, 0x04, 0x00, 0x18, 0x1B, 0x1A, 0x07,},
|
||||
{ 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x11, 0x10, 0x01,},
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
|
||||
|
||||
{ 0x01, 0x00, 0x03, 0x41, 0x05, 0x40, 0x09, 0x11, 0x21,},
|
||||
{ 0x05, 0x01, 0x01, 0x19, 0x04, 0x07, 0x00, 0x18, 0x0D,},
|
||||
{ 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x01, 0x00, 0x03,},
|
||||
{ 0x01, 0x05, 0x00, 0x0D, 0x01, 0x04, 0x07, 0x19, 0x18,},
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
|
||||
{ 0x31, 0x01, 0x05, 0x19, 0x04, 0x07, 0x00, 0x30, 0x0D,},
|
||||
{ 0x01, 0x00, 0x03, 0x11, 0x01, 0x05, 0x01, 0x09, 0x10,},
|
||||
{ 0x01, 0x05, 0x01, 0x11, 0x01, 0x10, 0x00, 0x03, 0x09,},
|
||||
{ 0x01, 0x09, 0x00, 0x29, 0x03, 0x08, 0x28, 0x15, 0x0B,},
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
|
||||
|
||||
{ 0x01, 0x01, 0x00, 0x09, 0x15, 0x03, 0x08, 0x14, 0x0B,},
|
||||
{ 0x11, 0x01, 0x01, 0x00, 0x09, 0x01, 0x03, 0x10, 0x05,},
|
||||
{ 0x01, 0x00, 0x03, 0x25, 0x11, 0x05, 0x10, 0x24, 0x13,},
|
||||
{ 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x05, 0x10, 0x03,},
|
||||
{ 0x05, 0x01, 0x00, 0x0D, 0x0C, 0x04, 0x0F, 0x1D, 0x1C,},
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
|
||||
{ 0x21, 0x01, 0x05, 0x09, 0x11, 0x00, 0x03, 0x41, 0x40,},
|
||||
{ 0x05, 0x01, 0x00, 0x1D, 0x1C, 0x0D, 0x0C, 0x0F, 0x04,},
|
||||
{ 0x05, 0x01, 0x00, 0x0D, 0x31, 0x04, 0x19, 0x30, 0x07,},
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
|
||||
|
||||
{ 0x01, 0x01, 0x00, 0x21, 0x05, 0x11, 0x03, 0x09, 0x20,},
|
||||
{ 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x01, 0x09, 0x10,},
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
|
||||
{ 0x05, 0x01, 0x04, 0x19, 0x07, 0x0D, 0x00, 0x31, 0x30,},
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
|
||||
{ 0x05, 0x01, 0x01, 0x11, 0x09, 0x00, 0x03, 0x21, 0x20,},
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
|
||||
{ 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x01, 0x01, 0x02,},
|
||||
{ 0x09, 0x01, 0x00, 0x29, 0x08, 0x15, 0x03, 0x28, 0x0B,},
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
|
||||
|
||||
{ 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
|
||||
{ 0x09, 0x01, 0x00, 0x29, 0x28, 0x15, 0x08, 0x03, 0x0B,},
|
||||
{ 0x01, 0x00, 0x01, 0x11, 0x05, 0x10, 0x09, 0x01, 0x03,},
|
||||
{ 0x05, 0x04, 0x01, 0x1D, 0x0D, 0x0C, 0x1C, 0x00, 0x0F,},
|
||||
{ 0x09, 0x11, 0x01, 0x41, 0x00, 0x40, 0x05, 0x03, 0x21,},
|
||||
{ 0x0D, 0x05, 0x01, 0x1D, 0x1C, 0x0C, 0x04, 0x00, 0x0F,},
|
||||
{ 0x41, 0x09, 0x01, 0x40, 0x00, 0x11, 0x05, 0x03, 0x21,},
|
||||
{ 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
|
||||
{ 0x05, 0x04, 0x01, 0x0D, 0x01, 0x0C, 0x07, 0x01, 0x00,},
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
|
||||
|
||||
{ 0x05, 0x04, 0x01, 0x07, 0x19, 0x31, 0x30, 0x0D, 0x00,},
|
||||
{ 0x21, 0x01, 0x01, 0x00, 0x11, 0x09, 0x20, 0x05, 0x03,},
|
||||
{ 0x05, 0x01, 0x01, 0x04, 0x07, 0x0D, 0x0C, 0x00, 0x01,},
|
||||
{ 0x21, 0x09, 0x01, 0x00, 0x20, 0x05, 0x23, 0x22, 0x03,},
|
||||
{ 0x31, 0x0D, 0x01, 0x19, 0x05, 0x30, 0x04, 0x07, 0x00,},
|
||||
{ 0x31, 0x05, 0x01, 0x04, 0x19, 0x00, 0x0D, 0x30, 0x07,},
|
||||
{ 0x31, 0x01, 0x00, 0x0D, 0x05, 0x19, 0x04, 0x30, 0x07,},
|
||||
{ 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02, 0x01, 0x01,},
|
||||
{ 0x01, 0x00, 0x01, 0x01, 0x05, 0x09, 0x08, 0x03, 0x01,},
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
|
||||
};
|
||||
|
||||
static const uint8_t aic_mode1_vlc_bits[AIC_MODE1_NUM][AIC_MODE1_SIZE] = {
|
||||
{ 1, 4, 2, 7, 4, 6, 4, 7, 5,},
|
||||
{ 5, 1, 3, 4, 6, 3, 3, 7, 7,},
|
||||
{ 1, 4, 2, 7, 6, 7, 5, 4, 4,},
|
||||
{ 1, 3, 3, 3, 7, 4, 5, 7, 6,},
|
||||
{ 2, 4, 2, 6, 4, 5, 2, 4, 6,},
|
||||
{ 7, 2, 3, 4, 7, 1, 5, 7, 7,},
|
||||
{ 5, 1, 3, 6, 5, 5, 2, 7, 7,},
|
||||
{ 2, 5, 1, 7, 3, 7, 5, 5, 6,},
|
||||
{ 2, 4, 1, 4, 5, 7, 6, 7, 4,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
|
||||
{ 2, 1, 3, 6, 5, 5, 5, 7, 7,},
|
||||
{ 5, 1, 3, 4, 6, 3, 3, 7, 7,},
|
||||
{ 4, 1, 2, 6, 5, 5, 4, 5, 6,},
|
||||
{ 3, 1, 3, 4, 6, 3, 5, 7, 7,},
|
||||
{ 4, 1, 3, 6, 3, 5, 3, 7, 7,},
|
||||
{ 6, 1, 4, 4, 5, 2, 4, 7, 7,},
|
||||
{ 7, 1, 5, 7, 4, 3, 2, 7, 7,},
|
||||
{ 5, 3, 2, 7, 5, 6, 1, 5, 7,},
|
||||
{ 4, 1, 2, 6, 7, 5, 4, 7, 4,},
|
||||
{ 1, 0, 1, 0, 0, 0, 0, 0, 0,},
|
||||
|
||||
{ 3, 3, 1, 5, 5, 6, 6, 5, 3,},
|
||||
{ 6, 2, 1, 5, 6, 5, 4, 4, 5,},
|
||||
{ 6, 4, 1, 7, 6, 7, 6, 3, 2,},
|
||||
{ 4, 3, 1, 4, 6, 4, 6, 5, 3,},
|
||||
{ 6, 5, 1, 7, 4, 7, 3, 3, 3,},
|
||||
{ 7, 2, 2, 3, 7, 2, 4, 6, 5,},
|
||||
{ 6, 2, 2, 6, 4, 5, 2, 4, 4,},
|
||||
{ 4, 4, 1, 7, 6, 7, 5, 2, 4,},
|
||||
{ 5, 4, 1, 5, 6, 6, 5, 4, 2,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
|
||||
{ 2, 2, 2, 3, 5, 5, 6, 6, 5,},
|
||||
{ 7, 1, 3, 3, 6, 3, 4, 7, 5,},
|
||||
{ 2, 4, 1, 4, 6, 7, 7, 5, 4,},
|
||||
{ 7, 4, 3, 1, 5, 3, 6, 7, 3,},
|
||||
{ 4, 3, 3, 4, 1, 6, 4, 6, 5,},
|
||||
{ 7, 4, 4, 2, 6, 1, 4, 7, 5,},
|
||||
{ 5, 2, 3, 4, 4, 3, 2, 5, 4,},
|
||||
{ 3, 5, 2, 3, 2, 5, 5, 5, 3,},
|
||||
{ 6, 4, 4, 2, 5, 4, 7, 7, 1,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
|
||||
{ 2, 2, 2, 7, 3, 7, 4, 5, 6,},
|
||||
{ 4, 1, 3, 6, 4, 4, 3, 6, 5,},
|
||||
{ 2, 4, 1, 7, 3, 7, 6, 6, 6,},
|
||||
{ 3, 4, 3, 5, 1, 4, 4, 6, 6,},
|
||||
{ 4, 5, 2, 7, 1, 7, 3, 7, 7,},
|
||||
{ 6, 2, 3, 5, 3, 3, 2, 6, 4,},
|
||||
{ 4, 4, 4, 7, 2, 5, 1, 6, 7,},
|
||||
{ 4, 5, 2, 7, 1, 7, 4, 4, 6,},
|
||||
{ 2, 4, 2, 6, 2, 4, 6, 5, 4,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
|
||||
{ 1, 3, 3, 5, 6, 3, 5, 6, 5,},
|
||||
{ 7, 1, 4, 4, 6, 2, 4, 7, 5,},
|
||||
{ 2, 2, 2, 6, 5, 3, 5, 6, 5,},
|
||||
{ 7, 4, 4, 2, 6, 1, 5, 7, 4,},
|
||||
{ 3, 2, 2, 4, 4, 3, 4, 5, 5,},
|
||||
{ 7, 2, 5, 3, 7, 1, 4, 7, 7,},
|
||||
{ 6, 2, 3, 4, 5, 2, 2, 7, 7,},
|
||||
{ 3, 2, 2, 5, 5, 4, 4, 4, 3,},
|
||||
{ 3, 2, 2, 4, 6, 3, 5, 6, 3,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
|
||||
{ 1, 3, 3, 7, 4, 6, 3, 5, 7,},
|
||||
{ 4, 1, 4, 7, 4, 5, 2, 6, 7,},
|
||||
{ 2, 4, 1, 7, 5, 7, 3, 7, 7,},
|
||||
{ 3, 2, 3, 5, 3, 4, 2, 6, 6,},
|
||||
{ 3, 5, 4, 7, 2, 7, 1, 7, 7,},
|
||||
{ 4, 1, 3, 6, 5, 3, 3, 7, 7,},
|
||||
{ 4, 2, 5, 7, 3, 7, 1, 7, 7,},
|
||||
{ 7, 4, 1, 7, 3, 7, 2, 5, 7,},
|
||||
{ 4, 2, 2, 6, 4, 5, 2, 6, 4,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
|
||||
{ 3, 4, 1, 7, 6, 7, 6, 2, 6,},
|
||||
{ 4, 2, 2, 6, 6, 5, 4, 2, 4,},
|
||||
{ 4, 4, 1, 7, 5, 7, 6, 2, 4,},
|
||||
{ 3, 3, 2, 5, 4, 4, 5, 2, 4,},
|
||||
{ 4, 5, 2, 7, 2, 7, 3, 2, 6,},
|
||||
{ 4, 3, 2, 5, 5, 4, 3, 2, 4,},
|
||||
{ 7, 4, 2, 7, 2, 5, 3, 2, 6,},
|
||||
{ 4, 6, 2, 7, 3, 7, 6, 1, 6,},
|
||||
{ 5, 5, 1, 6, 4, 6, 5, 2, 4,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
|
||||
{ 3, 3, 2, 3, 5, 6, 6, 4, 2,},
|
||||
{ 7, 1, 3, 3, 6, 5, 7, 4, 3,},
|
||||
{ 5, 4, 1, 5, 5, 6, 6, 4, 2,},
|
||||
{ 6, 4, 2, 2, 6, 3, 6, 6, 2,},
|
||||
{ 6, 4, 2, 5, 3, 6, 3, 3, 2,},
|
||||
{ 6, 3, 2, 3, 5, 2, 4, 6, 3,},
|
||||
{ 6, 2, 2, 4, 3, 5, 3, 6, 3,},
|
||||
{ 7, 5, 1, 7, 4, 7, 7, 3, 2,},
|
||||
{ 5, 5, 2, 3, 6, 7, 7, 5, 1,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
};
|
||||
|
||||
//@}
|
||||
|
||||
#define PBTYPE_ESCAPE 0xFF
|
||||
|
||||
/** tables used for P-frame macroblock type decoding */
|
||||
//@{
|
||||
#define NUM_PTYPE_VLCS 7
|
||||
#define PTYPE_VLC_SIZE 8
|
||||
#define PTYPE_VLC_BITS 7
|
||||
|
||||
static const uint8_t ptype_vlc_codes[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = {
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
|
||||
{ 0x0D, 0x05, 0x01, 0x04, 0x01, 0x00, 0x07, 0x0C },
|
||||
{ 0x09, 0x11, 0x01, 0x00, 0x05, 0x03, 0x21, 0x20 },
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
|
||||
};
|
||||
|
||||
static const uint8_t ptype_vlc_bits[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = {
|
||||
{ 1, 2, 3, 6, 5, 4, 7, 7 },
|
||||
{ 3, 1, 2, 7, 6, 5, 4, 7 },
|
||||
{ 5, 4, 1, 4, 3, 3, 4, 5 },
|
||||
{ 4, 5, 2, 2, 3, 2, 6, 6 },
|
||||
{ 5, 6, 1, 4, 2, 3, 7, 7 },
|
||||
{ 5, 6, 1, 4, 3, 2, 7, 7 },
|
||||
{ 6, 3, 2, 7, 5, 4, 1, 7 }
|
||||
};
|
||||
|
||||
static const uint8_t ptype_vlc_syms[PTYPE_VLC_SIZE] = {
|
||||
0, 1, 2, 3, 8, 9, 11, PBTYPE_ESCAPE
|
||||
};
|
||||
|
||||
/** reverse of ptype_vlc_syms */
|
||||
static const uint8_t block_num_to_ptype_vlc_num[12] = {
|
||||
0, 1, 2, 3, 0, 0, 2, 0, 4, 5, 0, 6
|
||||
};
|
||||
//@}
|
||||
|
||||
/** tables used for P-frame macroblock type decoding */
|
||||
//@{
|
||||
#define NUM_BTYPE_VLCS 6
|
||||
#define BTYPE_VLC_SIZE 7
|
||||
#define BTYPE_VLC_BITS 6
|
||||
|
||||
static const uint8_t btype_vlc_codes[NUM_BTYPE_VLCS][BTYPE_VLC_SIZE] = {
|
||||
{ 0x01, 0x05, 0x00, 0x03, 0x11, 0x09, 0x10 },
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
|
||||
{ 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x08 },
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
|
||||
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
|
||||
};
|
||||
|
||||
static const uint8_t btype_vlc_bits[NUM_BTYPE_VLCS][PTYPE_VLC_SIZE] = {
|
||||
{ 2, 3, 2, 2, 5, 4, 5 },
|
||||
{ 4, 1, 3, 2, 6, 5, 6 },
|
||||
{ 6, 4, 1, 2, 5, 3, 6 },
|
||||
{ 5, 3, 3, 1, 4, 3, 5 },
|
||||
{ 6, 5, 3, 2, 4, 1, 6 },
|
||||
{ 6, 5, 3, 1, 4, 2, 6 }
|
||||
};
|
||||
|
||||
static const uint8_t btype_vlc_syms[BTYPE_VLC_SIZE] = {
|
||||
0, 1, 4, 5, 10, 7, PBTYPE_ESCAPE
|
||||
};
|
||||
|
||||
/** reverse of btype_vlc_syms */
|
||||
static const uint8_t block_num_to_btype_vlc_num[12] = {
|
||||
0, 1, 0, 0, 2, 3, 0, 5, 0, 0, 4, 0
|
||||
};
|
||||
//@}
|
||||
#endif /* FFMPEG_RV40VLC2_H */
|
||||
Reference in New Issue
Block a user