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

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

?? cavlc.c

?? 文件為H.264編解碼器 僅供參考 包括windows版本和DM642版本
?? 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一区二区三区免费野_久草精品视频
欧美变态tickle挠乳网站| 国产成人精品免费看| 日韩欧美亚洲另类制服综合在线| 大陆成人av片| 欧美在线一二三| 欧美一级高清片| 亚洲日本青草视频在线怡红院| 午夜日韩在线电影| 国产剧情一区在线| 欧美性大战久久久| 久久蜜桃av一区二区天堂 | 宅男噜噜噜66一区二区66| 精品国产1区2区3区| 亚洲黄色小视频| 亚洲成人先锋电影| 成人福利在线看| 欧美一区二区视频在线观看| 国产精品女主播av| 精品一区二区三区av| 国产成人精品网址| 91麻豆精品国产91久久久久 | 97久久超碰国产精品电影| 91精品国产乱| 亚洲国产裸拍裸体视频在线观看乱了| 美女视频一区在线观看| 色综合一区二区三区| 国产校园另类小说区| 日韩电影在线看| 日本韩国欧美在线| 国产精品久久久久四虎| 日韩国产精品久久久久久亚洲| 色综合中文字幕国产| 麻豆成人91精品二区三区| 91福利区一区二区三区| 国产精品乱人伦中文| 久久国产精品第一页| 欧美一区二区视频在线观看| 亚洲制服丝袜一区| 97se狠狠狠综合亚洲狠狠| 精品精品国产高清a毛片牛牛| 中文字幕在线一区二区三区| 国产suv精品一区二区6| 精品国产乱码久久久久久久久| 日本va欧美va瓶| 日韩精品一区二区三区视频| 麻豆国产精品官网| 亚洲精品在线免费观看视频| 麻豆国产精品777777在线| 日韩欧美另类在线| 国精产品一区一区三区mba视频| 欧美成人性福生活免费看| 九九精品视频在线看| 欧美va日韩va| 国产成人在线视频网站| 中文字幕国产一区| av一区二区不卡| 综合分类小说区另类春色亚洲小说欧美| 成人性生交大片免费| 国产精品久久久久久久久动漫| 不卡视频免费播放| 亚洲男人都懂的| 欧美精三区欧美精三区| 亚洲午夜国产一区99re久久| 欧美日韩免费一区二区三区视频| 亚洲线精品一区二区三区| 日韩欧美在线影院| 国内精品免费在线观看| 久久久99免费| 99在线精品观看| 亚洲已满18点击进入久久| 欧美在线高清视频| 美女网站在线免费欧美精品| 国产喷白浆一区二区三区| 99视频在线精品| 日韩高清电影一区| 欧美激情一区三区| 欧美综合一区二区| 久久精品国产秦先生| 国产精品三级久久久久三级| 欧美性欧美巨大黑白大战| 国产伦精品一区二区三区免费迷| |精品福利一区二区三区| 欧美一区二区视频观看视频| 国产成人精品在线看| 亚洲国产你懂的| 精品国产百合女同互慰| 国产91露脸合集magnet| 亚洲国产精品欧美一二99| 国产午夜精品福利| 成人看片黄a免费看在线| 天天做天天摸天天爽国产一区| 日韩视频123| 国产成人精品免费一区二区| 亚洲高清免费视频| 国产欧美日韩亚州综合 | 首页国产欧美日韩丝袜| 国产精品无码永久免费888| 555www色欧美视频| 99久久精品费精品国产一区二区| 久久精品国产免费看久久精品| 一区二区三区不卡在线观看| 日韩午夜av一区| 在线免费观看日本欧美| 亚洲电影视频在线| 精品久久人人做人人爱| 欧美日韩亚洲不卡| 99热国产精品| 成人理论电影网| 国产一区 二区| 精品亚洲porn| 日本不卡视频在线| 亚洲成人久久影院| 亚洲欧美日韩一区二区三区在线观看 | 1区2区3区欧美| 国产女主播一区| 精品国精品自拍自在线| 欧美一区永久视频免费观看| 色婷婷综合久久久久中文一区二区 | 亚洲bdsm女犯bdsm网站| 亚洲免费观看视频| 亚洲欧美色一区| 最新久久zyz资源站| 中文在线免费一区三区高中清不卡| 欧美成人vr18sexvr| 日韩午夜av一区| 欧美一区二区黄色| 欧美一级黄色片| 欧美电影免费观看高清完整版| 欧美一区二区三区影视| 日韩精品中文字幕在线一区| 日韩欧美视频一区| 精品福利一二区| 久久久久久久久岛国免费| www精品美女久久久tv| 精品国产亚洲一区二区三区在线观看| 911精品国产一区二区在线| 欧美日韩小视频| 日韩午夜三级在线| 久久天天做天天爱综合色| 26uuu国产日韩综合| 久久久综合激的五月天| 国产日韩视频一区二区三区| 国产精品麻豆欧美日韩ww| 亚洲人成在线观看一区二区| 亚洲综合区在线| 久久精品国内一区二区三区| 经典三级在线一区| 国产凹凸在线观看一区二区| 91在线观看视频| 欧美综合在线视频| 欧美成人综合网站| 国产精品热久久久久夜色精品三区 | 亚洲人成网站精品片在线观看| 一区二区三区欧美久久| 日韩av午夜在线观看| 国内不卡的二区三区中文字幕| 久久国产精品99久久久久久老狼| 国产高清无密码一区二区三区| 成人av在线播放网站| 欧美在线一二三| 欧美一区二区在线免费观看| 欧美日韩国产另类一区| 日韩免费视频一区二区| 日韩视频一区在线观看| 国产精品国产自产拍在线| 亚洲乱码中文字幕| 久久精品国产亚洲aⅴ| 99综合电影在线视频| 日韩欧美一二区| 伊人婷婷欧美激情| 国产精品一卡二卡| 欧美久久久久久久久中文字幕| 久久免费美女视频| 日韩精品电影在线| 99久久精品国产毛片| 欧美xxxxx牲另类人与| 亚洲三级小视频| 国产一区二区三区视频在线播放| av男人天堂一区| 日韩欧美久久久| 亚洲综合一区在线| 成人激情黄色小说| 久久亚洲综合色一区二区三区| 亚洲精品亚洲人成人网在线播放| 国产一区在线视频| 在线播放日韩导航| 亚洲综合丁香婷婷六月香| 国产精品1024| 欧美电视剧免费观看| 一卡二卡欧美日韩| 成人av在线播放网址| 精品国产a毛片| 日日欢夜夜爽一区| 91福利在线免费观看| 国产精品乱人伦一区二区| 国产成人精品免费在线| 久久综合九色欧美综合狠狠| 蜜桃视频免费观看一区| 91精品国产手机| 视频一区在线播放|