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

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

?? t264dec.c

?? H264EncPlayer,H264協議解碼與播放代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*****************************************************************************
*
*  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
*
****************************************************************************/

#include "config.h"
#include "stdio.h"
#include "T264.h"
#include "bitstream.h"
#include "utility.h"
#ifndef CHIP_DM642
#include "memory.h"
#endif
#include "assert.h"
#ifndef CHIP_DM642
#ifndef ARM
#include "sse2.h"
#endif
#endif
#include "interpolate.h"
#include "math.h"
#include "dct.h"
#include "dec_cavlc.h"
#include "deblock.h"
#include "block.h"
//for dec CABAC
#include "cabac_engine.h"
#include "dec_cabac.h"
#include "inter.h"
#define NAL_BUFFER_LEN 1024 * 1024  /* big enough ? */

void
T264dec_load_ref(T264_t* t)
{
    int32_t i, j, k;

    t->rec = &t->refn[0];

    if (t->slice_type == SLICE_P)
    {
        for(i = 0, j = 0 ; i < t->refl0_num ; i ++)
        {
            if (t->refn[i + 1].poc >= 0)
            {
                t->ref[0][j ++] = &t->refn[i + 1];
            }
        }
    }
    else if (t->slice_type == SLICE_B)
    {
        for(i = 0, j = 0, k = 0 ; i < t->refl0_num + t->refl1_num; i ++)
        {
            if (t->refn[i + 1].poc < t->slice.pic_order_cnt_lsb)
            {
                if (t->refn[i + 1].poc >= 0)
                    t->ref[0][j ++] = &t->refn[i + 1];
            }
            else
            {
                // yes, t->refn[i].poc already > 0
                t->ref[1][k ++] = &t->refn[i + 1];
            }
        }
    }
}

void
T264dec_save_ref(T264_t* t)
{
    int32_t i;
    T264_frame_t tmp;
    /* deblock filter exec here */
    if (t->need_deblock)
        T264_deblock_frame(t, t->rec);
    /* current only del with i,p */
    T264_extend_border(t, t->rec);
    T264_interpolate_halfpel(t, t->rec);

    tmp = t->refn[t->ss.num_ref_frames];
    t->refn[0].poc = t->slice.pic_order_cnt_lsb;
    for(i = t->ss.num_ref_frames ; i >= 1 ; i --)
    {
        t->refn[i] = t->refn[i - 1];
    }

    t->refn[0] = tmp;
}

void
T264dec_mb_load_context(T264_t* t, int32_t mb_y, int32_t mb_x)
{
    int32_t i, j;

    /* nnz count will be set in read_cavlc, but in many cases, 
        nnz will equal to 0 because cbp == 0
     */
    memset(t->mb.nnz, 0, sizeof(t->mb.nnz));
    memset(t->mb.nnz_ref, 0, sizeof(t->mb.nnz_ref));
    memset(t->mb.mode_i4x4, Intra_4x4_DC, 16 * sizeof(uint8_t));
    memset(t->mb.submb_part, -1, sizeof(t->mb.submb_part));
    memset(t->mb.dct_y_z, 0, sizeof(t->mb.dct_y_z));
    memset(t->mb.dct_uv_z, 0, sizeof(t->mb.dct_uv_z));
    memset(t->mb.dc4x4_z, 0, sizeof(t->mb.dc4x4_z));
    memset(t->mb.dc2x2_z, 0, sizeof(t->mb.dc2x2_z));
    t->mb.mb_part = -1;
#define INITINVALIDVEC(vec) vec.refno = -1; vec.x = vec.y = 0;
    for(i = 0 ; i < 2 ; i ++)
    {
        for(j = 0 ; j < 16 ; j ++)
        {
            INITINVALIDVEC(t->mb.vec[i][j]);
        }
    }
#undef INITINVALIDVEC

    T264_mb_load_context(t, mb_y, mb_x);
    
    t->mb.src_y = t->mb.dst_y;
    t->mb.src_u = t->mb.dst_u;
    t->mb.src_v = t->mb.dst_v;
}

void
T264dec_mb_decode(T264_t* t)
{
    /* p skip decode as p mode */
    if(t->mb.mb_mode == P_MODE)
    {
        T264dec_mb_decode_interp_y(t);

        //
        // Chroma
        //
        T264dec_mb_decode_interp_uv(t);

        t->stat.p_block_num[t->mb.mb_part] ++;
    }
    else if (t->mb.mb_mode == B_MODE)
    {
        T264dec_mb_decode_interb_y(t);

        //
        // Chroma
        //
        T264dec_mb_decode_interb_uv(t);

        t->stat.b_block_num[t->mb.mb_part] ++;
    }
    else if (t->mb.mb_mode == I_4x4 || t->mb.mb_mode == I_16x16)
    {
        T264dec_mb_decode_intra_y(t);

        //
        // Chroma
        //
        T264dec_mb_decode_intra_uv(t);

        t->stat.i_block_num[t->mb.mb_mode] ++;
    }
}

void
T264dec_mb_save_context(T264_t* t, int32_t i, int32_t j)
{
    memcpy(t->mb.context, &t->mb, sizeof(*t->mb.context));
}

void
T264dec_parse_slice_header(T264_t* t)
{
    t->slice.first_mb_in_slice = eg_read_ue(t->bs); 
    assert(t->slice.first_mb_in_slice == 0);
    t->slice_type = t->slice.slice_type = eg_read_ue(t->bs);
    t->slice.pic_id = eg_read_ue(t->bs);    
    t->slice.frame_num = eg_read_direct(t->bs, t->ss.log2_max_frame_num_minus4 + 4);
    if (t->nal.nal_unit_type == NAL_SLICE_IDR)
    {
        t->slice.idr_pic_id = eg_read_ue(t->bs);
    }
    if (t->ss.pic_order_cnt_type == 0)
    {
        t->poc = t->slice.pic_order_cnt_lsb = eg_read_direct(t->bs, t->ss.max_pic_order + 4);
    }
    if (t->slice_type == SLICE_P)
    {
        t->refl1_num = 0;
        t->refl0_num = t->ps.num_ref_idx_l0_active_minus1 + 1;
        // num_ref_idx_active_override_flag
        if (eg_read_direct(t->bs, 1))
        {
            t->refl0_num = eg_read_ue(t->bs) + 1;
        }
    }
    else if (t->slice_type == SLICE_B)
    {
        // direct_spatial_mv_pred_flag
        t->param.direct_flag = t->slice.direct_spatial_mv_pred_flag = eg_read_direct(t->bs, 1);
        t->refl1_num = 1;
        t->refl0_num = t->ps.num_ref_idx_l0_active_minus1 + 1;
        // num_ref_idx_active_override_flag
        if (eg_read_direct(t->bs, 1))
        {
            t->refl0_num = eg_read_ue(t->bs) + 1;
            t->refl1_num = eg_read_ue(t->bs) + 1;
        }
    }

    /* ref_pic_list_reordering() */
    if(t->slice.slice_type != SLICE_I && t->slice.slice_type != SLICE_SI )
    {
        eg_read_skip(t->bs, 1);
        if (t->slice.slice_type == SLICE_B)
            eg_read_skip(t->bs, 1);
    }

    if (t->nal.nal_ref_idc != 0)
    {
        /* dec_ref_pic_marking() */
        if (t->nal.nal_unit_type == NAL_SLICE_IDR)
        {
            eg_read_direct(t->bs, 1);
            eg_read_direct(t->bs, 1);
        }
        else
        {
            eg_read_direct(t->bs, 1);
        }
    }
	//for dec CABAC
	if(t->ps.entroy_coding_mode_flag!=0 && t->slice_type!= SLICE_I)
	{
		t->slice.cabac_init_idc = eg_read_ue(t->bs);
	}
    t->qp_y = eg_read_se(t->bs) + t->ps.pic_init_qp_minus26 + 26;
    if (t->ps.deblocking_filter_control_present_flag)
    {
        t->need_deblock = !eg_read_ue(t->bs);
    }
}

static void __inline
get_output_frame(T264_t* t)
{
    /* we will reorder the output frame */
    if (t->slice_type != SLICE_B)
    {
        t->output.poc = -2;
        if (t->frame_num > 0)
        {
            //
            // refn[0] = current reconstruct frame
            // refn[1] = ref frame 1
            // refn[2] = ref frame 2
            //
            t->output = t->refn[1];
        }
    }
    else
    {
        // slice b always should send immediately
        t->output = t->refn[0];
    }
}

/* currently we _only_ support one slice */
void
T264dec_parse_slice(T264_t* t)
{
    int32_t i, j, skip, end_of_slice;
	//to be cleaned
	//extern int frame_cabac, mb_cabac, slice_type_cabac;
    T264dec_parse_slice_header(t);
    
    T264dec_load_ref(t);

	//for dec CABAC
	if( t->ps.entroy_coding_mode_flag == 1 )
	{
		/* alignment needed */
		BitstreamByteAlign( t->bs );

		/* init cabac */
		T264_cabac_context_init( &t->cabac, t->slice_type, t->ps.pic_init_qp_minus26+26+t->slice.slice_qp_delta, t->slice.cabac_init_idc );
		T264_cabac_decode_init ( &t->cabac, t->bs );
	}
    t->skip = -1;
    for(i = 0 ; i < t->mb_height ; i ++)
    {
        for(j = 0 ; j < t->mb_width ; j ++)
        {
            T264dec_mb_load_context(t, i, j);
            if( t->ps.entroy_coding_mode_flag == 1 )
			{
				//CABAC
				if(t->mb.mb_xy > 0)
				{
					end_of_slice = T264_cabac_decode_terminal(&t->cabac);
					assert(end_of_slice == 0);
				}
				skip = T264dec_mb_read_cabac(t);
			}
			else
			{
				//CAVLC
				T264dec_mb_read_cavlc(t);
			}	

            T264dec_mb_decode(t);
			if(t->ps.entroy_coding_mode_flag==1 && skip)
			{
				t->mb.mb_mode = (t->slice_type==SLICE_B)?B_SKIP:P_SKIP;
			}
            T264dec_mb_save_context(t, i, j);
        }
    }
	if( t->ps.entroy_coding_mode_flag == 1 )
	{
		/* end of slice */
		end_of_slice = T264_cabac_decode_terminal(&t->cabac);
		assert(end_of_slice == 1);
		BitstreamByteAlign(t->bs);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美性视频一区二区三区| 亚洲一区免费在线观看| 亚洲品质自拍视频| 99精品视频免费在线观看| 26uuu国产电影一区二区| 国产不卡在线视频| 国产精品污污网站在线观看| 色婷婷综合久久久久中文一区二区| 91.xcao| 国产在线不卡一区| 亚洲视频一区在线| 欧美三级乱人伦电影| 亚洲丶国产丶欧美一区二区三区| 在线播放日韩导航| 欧美精品九九99久久| 狠狠狠色丁香婷婷综合激情| 精品国产精品网麻豆系列| 黑人精品欧美一区二区蜜桃| 亚洲欧洲www| 99久久综合国产精品| 国产精品美女一区二区在线观看| 风间由美一区二区av101| 蜜桃久久av一区| 精品久久久久久最新网址| 欧美在线影院一区二区| 99vv1com这只有精品| 久久精品二区亚洲w码| 久久先锋影音av鲁色资源网| 国产sm精品调教视频网站| 久久国产人妖系列| 依依成人精品视频| 久久久五月婷婷| 欧美经典一区二区| 久久综合久久鬼色中文字| 欧美精品久久99久久在免费线 | 成人免费在线视频观看| 国产喂奶挤奶一区二区三区| 日韩一区二区精品| 精品理论电影在线观看| 欧美刺激午夜性久久久久久久| 欧美一区永久视频免费观看| 欧美久久一二三四区| 欧美亚洲国产一区在线观看网站| 色婷婷综合五月| 91精品国产综合久久福利软件| 欧美白人最猛性xxxxx69交| 久久久精品国产免大香伊| 国产成人免费网站| 国产成人av在线影院| 91视频在线观看| 91精品国产综合久久婷婷香蕉| 7777精品伊人久久久大香线蕉超级流畅| 一本久久a久久精品亚洲| 欧美老女人在线| 久久视频一区二区| 亚洲国产精品久久久久婷婷884 | 老鸭窝一区二区久久精品| 精品一区免费av| 成人午夜精品一区二区三区| 色网站国产精品| 久久久精品日韩欧美| 亚洲电影一区二区| 国产成人免费在线视频| 91在线云播放| 555www色欧美视频| 成人动漫精品一区二区| 久久激情五月激情| 在线免费视频一区二区| 国产精品毛片久久久久久久| 久久99精品久久久久婷婷| 欧美日韩一区二区在线观看 | 一区二区成人在线| 91网上在线视频| 亚洲综合免费观看高清完整版在线 | 成人精品视频一区二区三区| 国产三级久久久| 国产主播一区二区三区| 91麻豆精品国产91久久久资源速度| 亚洲国产成人午夜在线一区| 欧美性猛片aaaaaaa做受| 丝袜美腿亚洲综合| 国产成人av一区二区三区在线| 欧洲一区在线电影| 国产欧美一区视频| 亚洲精品视频在线看| 老色鬼精品视频在线观看播放| 国产福利91精品| 久久夜色精品一区| 黑人巨大精品欧美一区| 91麻豆精东视频| 国产精品少妇自拍| 激情图区综合网| 欧美日韩国产区一| 日韩一级大片在线| 欧美日韩mp4| 亚洲精品免费在线| 一本到三区不卡视频| 国产精品欧美经典| 久久国产福利国产秒拍| 欧美精品777| 国产精品污污网站在线观看| 午夜影院在线观看欧美| 91片黄在线观看| 国产午夜精品久久久久久免费视| 青青青爽久久午夜综合久久午夜| 色综合激情五月| 亚洲人成小说网站色在线| 亚洲人精品一区| 麻豆一区二区三| 另类中文字幕网| 欧美电影免费观看高清完整版 | 欧美日本一道本在线视频| 日本特黄久久久高潮 | 国产无一区二区| 91视频精品在这里| 日本视频一区二区| 久久精品国产一区二区三区免费看| 国产露脸91国语对白| 国产无人区一区二区三区| 极品少妇一区二区| 一区二区三区国产| 91精品婷婷国产综合久久性色| 日韩国产精品大片| 亚洲欧洲一区二区三区| 日本一区中文字幕| 久久亚洲综合av| 一本一本大道香蕉久在线精品| 青娱乐精品在线视频| 欧美成人官网二区| 国产成人在线电影| 亚洲激情六月丁香| 高清国产午夜精品久久久久久| 亚洲蜜臀av乱码久久精品| 日韩一区二区三区在线观看| 国产不卡视频在线观看| 日韩avvvv在线播放| 亚洲欧洲三级电影| 国产欧美精品区一区二区三区 | 国产欧美日韩亚州综合| 日本成人在线视频网站| 欧美日韩精品一区二区在线播放| 免费一级片91| 久久精品一二三| 精品久久免费看| 日韩限制级电影在线观看| 色噜噜夜夜夜综合网| 色综合中文字幕国产| 国产一区二区三区久久久 | 裸体一区二区三区| 精品乱码亚洲一区二区不卡| 国产精品亚洲一区二区三区在线| 国产视频911| 中文字幕免费不卡| 国产精品卡一卡二卡三| 久久精品人人做人人爽人人| 久久婷婷色综合| 久久国产麻豆精品| 久久久精品免费观看| 日韩一区二区在线免费观看| 欧美美女喷水视频| 欧美日韩国产在线播放网站| 久久综合一区二区| 欧美mv和日韩mv国产网站| 99精品在线观看视频| 欧洲视频一区二区| 欧美精品99久久久**| 欧美一区二区二区| 91丨九色丨国产丨porny| 7777精品伊人久久久大香线蕉最新版| 欧美在线三级电影| 欧美刺激脚交jootjob| 99久久久精品免费观看国产蜜| 日本高清免费不卡视频| 日韩欧美亚洲一区二区| 国产精品欧美久久久久无广告| 亚洲综合久久久| 国内精品伊人久久久久av影院| 成人动漫在线一区| 日韩欧美在线影院| 亚洲欧美日韩系列| 国内一区二区在线| 在线综合+亚洲+欧美中文字幕| 欧美一区二区三区免费| 国产欧美日韩亚州综合| 亚洲欧洲精品一区二区三区| 国产精品久久久久久久久图文区| 欧美极品另类videosde| 日韩精品三区四区| 欧美日韩亚洲综合一区二区三区 | 91成人免费在线| 中文字幕乱码亚洲精品一区| 日韩国产欧美在线播放| 91国产免费观看| 中文字幕av不卡| 极品美女销魂一区二区三区免费| 91性感美女视频| 国产精品网站在线播放| 国产精品99久久久久久久vr | 国产精品一区二区在线观看不卡 | 曰韩精品一区二区|