亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cavlc.c

?? H264EncPlayer,H264協議解碼與播放代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*****************************************************************************
 *
 *  T264 AVC CODEC
 *
 *  Copyright(C) 2004-2005 llcc <lcgate1@yahoo.com.cn>
 *               2004-2005 visionany <visionany@yahoo.com.cn>
 *
 *  This program is free software ; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation ; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program ; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 ****************************************************************************/

 /*****************************************************************************
 * cavlc.c: from x 264
 *****************************************************************************/


//#include <stdlib.h>
//#include <string.h>
//#include <stdint.h>

#include <stdio.h>

#include "T264.h"
#include "vlc.h"
#include "bitstream.h"
#include "inter.h"
#include <assert.h>

static const uint8_t intra4x4_cbp_to_golomb[48]=
{
  3, 29, 30, 17, 31, 18, 37,  8, 32, 38, 19,  9, 20, 10, 11,  2,
 16, 33, 34, 21, 35, 22, 39,  4, 36, 40, 23,  5, 24,  6,  7,  1,
 41, 42, 43, 25, 44, 26, 46, 12, 45, 47, 27, 13, 28, 14, 15,  0
};
static const uint8_t inter_cbp_to_golomb[48]=
{
  0,  2,  3,  7,  4,  8, 17, 13,  5, 18,  9, 14, 10, 15, 16, 11,
  1, 32, 33, 36, 34, 37, 44, 40, 35, 45, 38, 41, 39, 42, 43, 19,
  6, 24, 25, 20, 26, 21, 46, 28, 27, 47, 22, 29, 23, 30, 31, 12
};

/*
static const uint8_t block_idx_x[16] =
{
    0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 3
};
static const uint8_t block_idx_y[16] =
{
    0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3
};
static const uint8_t block_idx_xy[4][4] =
{
    { 0, 2, 8,  10},
    { 1, 3, 9,  11},
    { 4, 6, 12, 14},
    { 5, 7, 13, 15}
};
*/

#define IS_DIRECT(x) (x == B_DIRECT_16x16 || x == B_DIRECT_8x8)
#define BLOCK_INDEX_CHROMA_DC   (-1)
#define BLOCK_INDEX_LUMA_DC     (-2)

static __inline void eg_write_vlc(bs_t* bs, vlc_t v)
{
	eg_write_direct(bs, v.i_bits & ((uint32_t)~0 >> (uint32_t)(32 - v.i_size)), v.i_size);
}

int8_t
T264_mb_predict_intra4x4_mode(T264_t *t, int32_t idx)
{
	int32_t x, y;
	int8_t nA, nB, pred_blk;

    x = luma_inverse_x[idx];
    y = luma_inverse_y[idx];

    nA = t->mb.i4x4_pred_mode_ref[IPM_LUMA + x + y * 8 - 1];
    nB = t->mb.i4x4_pred_mode_ref[IPM_LUMA + x + y * 8 - 8];
	
    pred_blk  = T264_MIN(nA, nB);

    if( pred_blk < 0 )
        return Intra_4x4_DC;

    return pred_blk;	
}

uint8_t 
T264_mb_predict_non_zero_code(T264_t* t, int idx)
{	
    int32_t x, y;
    int32_t nA, nB;
	int16_t pred_blk;

	if(idx >= 0 && idx < 16)
	{
        x = luma_inverse_x[idx];
        y = luma_inverse_y[idx];
        nA = t->mb.nnz_ref[NNZ_LUMA + x + y * 8 - 1];
        nB = t->mb.nnz_ref[NNZ_LUMA + x + y * 8 - 8];
	}
	else if(idx < 20)
	{
		y = (idx - 16) / 2;
		x = (idx - 16) % 2;
        nA = t->mb.nnz_ref[NNZ_CHROMA0 + x + y * 8 - 1];
        nB = t->mb.nnz_ref[NNZ_CHROMA0 + x + y * 8 - 8];
	}
	else if(idx < 24)
	{
        y = (idx - 20) / 2;
        x = (idx - 20) % 2;
        nA = t->mb.nnz_ref[NNZ_CHROMA1 + x + y * 8 - 1];
        nB = t->mb.nnz_ref[NNZ_CHROMA1 + x + y * 8 - 8];
	}
	
    pred_blk = nA + nB;

    if( pred_blk < 0x80 )
    {
        pred_blk = ( pred_blk + 1 ) >> 1;
    }
    return pred_blk & 0x7f;
}

/****************************************************************************
 * block_residual_write_cavlc
 ****************************************************************************/
static void block_residual_write_cavlc( T264_t *h, int32_t i_idx, int16_t *l, int32_t i_count )
{
    int level[16], run[16];
    int i_total, i_trailing;
    int i_total_zero;
    int i_last;
    unsigned int i_sign;

    int i;
    int i_zero_left;
    int i_suffix_length;

    /* first find i_last */
    i_last = i_count - 1;
    while( i_last >= 0 && l[i_last] == 0 )
    {
        i_last--;
    }

    i_sign = 0;
    i_total = 0;
    i_trailing = 0;
    i_total_zero = 0;

    if( i_last >= 0 )
    {
        int b_trailing = 1;
        int idx = 0;

        /* level and run and total */
        while( i_last >= 0 )
        {
            level[idx] = l[i_last--];

            run[idx] = 0;
            while( i_last >= 0 && l[i_last] == 0 )
            {
                run[idx]++;
                i_last--;
            }

            i_total++;
            i_total_zero += run[idx];

            if( b_trailing && ABS( level[idx] ) == 1 && i_trailing < 3 )
            {
                i_sign <<= 1;
                if( level[idx] < 0 )
                {
                    i_sign |= 0x01;
                }

                i_trailing++;
            }
            else
            {
                b_trailing = 0;
            }

            idx++;
        }
    }

    /* total/trailing represented by Coeff_token (5 tables)*/
    if( i_idx == BLOCK_INDEX_CHROMA_DC )
    {
		eg_write_vlc(h->bs, x264_coeff_token[4][i_total*4+i_trailing]);
    }
    else
    {
        /* T264_mb_predict_non_zero_code return 0 <-> (16+16+1)>>1 = 16 */
        static const int ct_index[17] = {0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,3 };
        int nC = 0;

        if( i_idx == BLOCK_INDEX_LUMA_DC )
        {
			// predict nC = (nA + nB) / 2;
            nC = T264_mb_predict_non_zero_code(h, 0);
        }
        else
        {
			// predict nC = (nA + nB) / 2;
            nC = T264_mb_predict_non_zero_code(h, i_idx);
        }

		eg_write_vlc(h->bs, x264_coeff_token[ct_index[nC]][i_total*4+i_trailing]);
    }

    if( i_total <= 0 )
    {
        return;
    }

	//encoding trailing '1's (max = 3)
    i_suffix_length = i_total > 10 && i_trailing < 3 ? 1 : 0;
    if( i_trailing > 0 )
    {
		eg_write_direct(h->bs, i_sign & ((uint32_t)~0 >> (uint32_t)(32 - i_trailing)), i_trailing);
    }

	//encoding remain levels of non-zero coefficients (prefix + suffix)
    for( i = i_trailing; i < i_total; i++ )
    {
        int i_level_code;

        /* calculate level code */
        if( level[i] < 0 )
        {
            i_level_code = -2*level[i] - 1;
        }
        else /* if( level[i] > 0 ) */
        {
            i_level_code = 2 * level[i] - 2;
        }
        if( i == i_trailing && i_trailing < 3 )
        {
            i_level_code -=2; /* as level[i] can't be 1 for the first one if i_trailing < 3 */
        }

        if( ( i_level_code >> i_suffix_length ) < 14 )
        {
            eg_write_vlc(h->bs, x264_level_prefix[i_level_code >> i_suffix_length]);
            if( i_suffix_length > 0 )
            {
				eg_write_direct(h->bs, (uint32_t)i_level_code & ((uint32_t)~0 >> (uint32_t)(32 - i_suffix_length)), i_suffix_length);
            }
        }
        else if( i_suffix_length == 0 && i_level_code < 30 )
        {
            eg_write_vlc(h->bs, x264_level_prefix[14]);
            eg_write_direct(h->bs, (i_level_code - 14) & ((uint32_t)~0 >> (uint32_t)(32 - 4)), 4);
        }
        else if( i_suffix_length > 0 && ( i_level_code >> i_suffix_length ) == 14 )
        {
            eg_write_vlc(h->bs, x264_level_prefix[14]);
            eg_write_direct(h->bs, i_level_code & ((uint32_t)~0 >> (uint32_t)(32 - i_suffix_length)), i_suffix_length);
        }
        else
        {
            eg_write_vlc(h->bs, x264_level_prefix[15]);
            i_level_code -= 15 << i_suffix_length;
            if( i_suffix_length == 0 )
            {
                i_level_code -= 15;
            }

            if( i_level_code >= ( 1 << 12 ) || i_level_code < 0 )
            {
                fprintf( stderr, "OVERFLOW levelcode=%d\n", i_level_code );
            }

			eg_write_direct(h->bs, i_level_code & ((uint32_t)~0 >> (uint32_t)(32 - 12)), 12);
        }

        if( i_suffix_length == 0 )
        {
            i_suffix_length++;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美性一区二区| 亚洲国产成人porn| 精品国免费一区二区三区| 欧美老人xxxx18| 欧美色图免费看| 欧美日韩午夜在线视频| 欧美精品乱码久久久久久按摩| 欧美色图在线观看| 欧美一区二区成人| 555夜色666亚洲国产免| 精品亚洲国内自在自线福利| 亚洲成人av一区二区| 亚洲成人久久影院| 美女一区二区视频| 国产一区二区三区在线观看免费视频| 蜜桃传媒麻豆第一区在线观看| 另类欧美日韩国产在线| 国产麻豆日韩欧美久久| 91蜜桃在线观看| 欧美高清视频一二三区| 精品国产乱码久久久久久蜜臀| 国产拍欧美日韩视频二区| 1024国产精品| 午夜激情综合网| 国产精品自拍三区| 日本道精品一区二区三区| 欧美精选午夜久久久乱码6080| 精品免费一区二区三区| 亚洲人成网站色在线观看| 五月综合激情网| 国产成人精品网址| 91国偷自产一区二区三区成为亚洲经典 | 欧美激情资源网| 一区二区三区中文字幕精品精品| 91豆麻精品91久久久久久| 欧美日韩高清在线| 亚洲视频一区二区在线| 亚洲一区在线观看视频| 奇米色一区二区| 99国产精品久久久| 欧美mv和日韩mv的网站| 亚洲免费在线视频一区 二区| 人人超碰91尤物精品国产| www.66久久| 欧美一级在线免费| 亚洲欧美一区二区三区久本道91 | 免费成人在线影院| av高清久久久| 欧美电影免费观看高清完整版在 | 91精品国产综合久久久久久 | 精品国产乱码久久久久久久久| 亚洲图片欧美激情| 国产精品一区三区| 欧美久久久久免费| 亚洲影视资源网| 91麻豆6部合集magnet| 国产日韩精品久久久| 青青草精品视频| 欧美日韩一区二区三区视频 | 日本系列欧美系列| 色8久久人人97超碰香蕉987| 久久精品无码一区二区三区| 日韩和欧美一区二区三区| 在线观看av不卡| 亚洲黄色录像片| 91论坛在线播放| 亚洲视频香蕉人妖| 91在线porny国产在线看| 欧美韩国日本综合| 国产一区不卡在线| 久久久噜噜噜久久中文字幕色伊伊 | 欧美系列一区二区| 亚洲午夜激情网站| 欧美色倩网站大全免费| 一区二区三区不卡视频在线观看 | 免费精品视频最新在线| 欧美日韩精品欧美日韩精品| 亚洲影院免费观看| 欧美视频在线一区| 视频在线在亚洲| 欧美顶级少妇做爰| 美女网站色91| 久久久精品免费观看| 国产成人高清在线| 日韩午夜小视频| 久久久久综合网| 久久久久国产精品人| 成人av网站免费| 成人小视频免费观看| 在线不卡中文字幕播放| 日本免费在线视频不卡一不卡二| 欧美日韩国产高清一区| 毛片基地黄久久久久久天堂| www欧美成人18+| 99综合影院在线| 亚洲电影欧美电影有声小说| 日韩亚洲电影在线| 国产凹凸在线观看一区二区| 中文字幕亚洲区| 欧美日韩精品一区二区天天拍小说| 午夜激情一区二区三区| 精品电影一区二区三区| 成人app在线观看| 亚洲第一福利一区| 337p日本欧洲亚洲大胆精品| 成人免费av资源| 亚洲午夜三级在线| 欧美激情艳妇裸体舞| 91福利资源站| 精品写真视频在线观看| 亚洲人精品午夜| 欧美xxxxx牲另类人与| 一本大道久久精品懂色aⅴ| 日韩高清国产一区在线| 国产精品国产三级国产a| 欧美久久久影院| 91丨porny丨在线| 久久www免费人成看片高清| 美女视频黄免费的久久| 国产精品欧美一区喷水| 欧美精品vⅰdeose4hd| 国产成人在线视频网站| 亚洲成av人片在线观看无码| 精品91自产拍在线观看一区| 欧美亚洲高清一区| 成人手机在线视频| 精品亚洲国内自在自线福利| 亚洲国产中文字幕| 国产精品成人一区二区三区夜夜夜| 欧美日韩精品久久久| www.亚洲精品| 国产在线一区观看| 日日夜夜精品免费视频| 亚洲综合小说图片| 中文字幕一区二区三区在线不卡| 91精品视频网| 欧美日韩国产中文| 国产精品99久久久久久宅男| 国产欧美一区二区精品忘忧草| 欧美日韩精品欧美日韩精品一 | 国产精品综合在线视频| 日韩精品国产精品| 亚洲一区自拍偷拍| 亚洲国产精品v| 精品捆绑美女sm三区| 欧美人xxxx| 欧美剧情片在线观看| 欧美性色综合网| 日本精品一区二区三区高清| 成人性色生活片| 白白色 亚洲乱淫| 成a人片国产精品| 成人app网站| 不卡av免费在线观看| 国产99久久精品| 成人丝袜18视频在线观看| 国产成人av影院| 成人毛片在线观看| a亚洲天堂av| 91女厕偷拍女厕偷拍高清| 国产91精品欧美| 94色蜜桃网一区二区三区| 一本色道久久综合亚洲91| 91小视频免费观看| 91国偷自产一区二区三区观看| 在线免费观看日本一区| 欧美日韩一二区| 欧美一区三区二区| 精品国产3级a| 国产精品女人毛片| 亚洲免费观看高清在线观看| 亚洲欧美日韩在线| 日韩高清一级片| 国产乱一区二区| 91欧美一区二区| 日韩欧美在线影院| 国产精品欧美久久久久一区二区| 亚洲天堂2016| 日韩不卡一区二区| 国产91精品欧美| 欧美久久一二三四区| 亚洲精品在线免费观看视频| 亚洲国产精品v| 日韩综合一区二区| 国产精品18久久久久久久久久久久| 久久精品二区亚洲w码| 色婷婷综合久久久| 日韩一区二区在线观看| 日韩欧美视频一区| 国产喷白浆一区二区三区| 一区二区三区四区蜜桃| 日本v片在线高清不卡在线观看| 久久国产免费看| 色婷婷av久久久久久久| 精品日韩成人av| 一区二区高清在线| 国产一区二区三区在线观看精品| 99久久免费国产| 久久久久久久久久久电影| 亚洲国产成人tv|