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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? estimation.c

?? H264EncPlayer,H264協(xié)議解碼與播放代碼
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
/*****************************************************************************
*
*  T264 AVC CODEC
*
*  Copyright(C) 2004-2005 llcc <lcgate1@yahoo.com.cn>
*               2004-2005 visionany <visionany@yahoo.com.cn>
*	2005.1.4 CloudWu<sywu@sohu.com>	modify diamond_search() 
*  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 "stdio.h"
#include "T264.h"
#include "estimation.h"
#ifndef CHIP_DM642
#include "memory.h"
#endif
#include "assert.h"
#include "bitstream.h"
#include "inter.h"

//overlapped check points 
static int32_t
check_vec(int32_t i, T264_vector_t* vec)
{
    int32_t j;

    for(j = 0 ; j < i ; j ++)
    {
        if (vec[i].x == vec[j].x && vec[i].y == vec[j].y && vec[i].refno == vec[j].refno)
            return 1;
    }

    return 0;
}

uint32_t
T264_search(T264_t* t, T264_search_context_t* context)
{
    uint32_t sad = -1;
    int32_t i;
    int32_t best = 0;

    T264_vector_t mv_pred;

    int32_t limit_x = context->limit_x;
    int32_t limit_y = context->limit_y;
    int32_t stride_cur = t->stride;
    int32_t stride_ref = t->edged_stride;
    int32_t list_index = context->list_index;

    // start point of current and reference block 
    int32_t row = context->offset / t->edged_stride;
    int32_t col = context->offset % t->edged_stride;
    uint8_t* cur = t->cur.Y[0] + row * stride_cur + col;
    uint8_t* ref_st;

    uint8_t* ref;
    int8_t best_ref_no;

    //adaptive thresholds
    uint32_t th0;

    th0 = context->height * context->width; //256 for median predictor (16x16)	

    // try median vector
    if (context->vec[0].refno >= 0)
    {
        // check this predictor
        mv_pred.refno = context->vec[0].refno;
        mv_pred.x = context->vec[0].x >> 2;
        mv_pred.y = context->vec[0].y >> 2;
        ref_st = t->ref[list_index][mv_pred.refno]->Y[0] + context->offset;
        ref = ref_st + mv_pred.y * stride_ref + mv_pred.x;
        sad = t->sad[context->mb_part](cur, stride_cur, ref, stride_ref) +
            t->mb.lambda * (eg_size_se(t->bs, (mv_pred.x << 2) - context->vec[0].x) + 
            eg_size_se(t->bs, (mv_pred.y << 2) - context->vec[0].y));
        if (sad < th0)
        {
            context->vec_best = context->vec[0];
            return sad;
        }
    }

    // try other predictors (set A)
    for (i = 1 ; i < context->vec_num ; i ++)
    {
        if (context->vec[i].refno >= 0)
        {
            if (!check_vec(i, context->vec)) //not checked before
            {
                uint32_t cursad;
                // check this predictor
                mv_pred.refno = context->vec[i].refno;
                mv_pred.x = context->vec[i].x >> 2;
                mv_pred.y = context->vec[i].y >> 2;
                ref_st = t->ref[list_index][mv_pred.refno]->Y[0] + context->offset;
                ref = ref_st + mv_pred.y * stride_ref + mv_pred.x;
                cursad = t->sad[context->mb_part](cur, stride_cur, ref, stride_ref) +
                    t->mb.lambda * (eg_size_se(t->bs, (mv_pred.x << 2) - context->vec[0].x) + 
                    eg_size_se(t->bs, (mv_pred.y << 2) - context->vec[0].y));

                if (cursad < sad)
                {
                    best = i;
                    sad = cursad;
                }
            }
        }
    }

    context->vec_best = context->vec[best];

    if (sad < th0)
        return sad;

    // ref_st of best reference frame
    if (context->vec[best].refno >= 0)
    {
        best_ref_no = context->vec[best].refno;	
    }
    else
    {
        context->vec_best.refno = 0;
        context->vec_best.x = context->vec_best.y = best_ref_no = 0;
    }
    ref_st = t->ref[list_index][best_ref_no]->Y[0] + context->offset;
    // diamond search 
    /* small diamond is the fastest, square diamond has slightly gain lower bitrate and
          pull the speed down severely. LDSP + SDSP maybe have some problem... */
//*/
    sad = small_diamond_search(t, cur, ref_st, context, stride_cur, stride_ref, sad);
/*/
    sad = square_diamond_search(t, cur, ref_st, context, stride_cur, stride_ref, sad);
/*//*
    sad = diamond_search(t, cur, ref_st, context, stride_cur, stride_ref, sad);
//*/
    return sad;	
}

uint32_t
small_diamond_search(T264_t* t, uint8_t* cur, uint8_t* ref_st, T264_search_context_t* context, int32_t stride_cur, int32_t stride_ref, uint32_t sad)
{
    int32_t limit_x = context->limit_x;
    int32_t limit_y = context->limit_y;
    //start mv
    int32_t mvx = context->vec_best.x >> 2;
    int32_t mvy = context->vec_best.y >> 2;
    // sad for start mv
    uint8_t* ref;
    uint8_t* better_ref;
    int32_t better_mvx;
    int32_t better_mvy;
    uint32_t cursad;
    uint8_t stop = 0;

    ref_st += mvy * stride_ref + mvx;

    better_mvx = mvx;
    better_mvy = mvy;
    better_ref = ref_st;

    while(!stop)
    {
        stop = 1;

        // search 4 points of sdsp
        {
#define CHECK_CANDIDATE(x_offset, y_offset, ref_offset) ref = ref_st + ref_offset;  \
                        cursad = t->sad[context->mb_part](cur, stride_cur, ref, stride_ref) +   \
                                 t->mb.lambda * (eg_size_se(t->bs, ((mvx + x_offset) << 2) - context->vec[0].x) +   \
                                 eg_size_se(t->bs, ((mvy + y_offset) << 2) - context->vec[0].y));   \
                        if (cursad < sad)   \
                        {   \
                            sad = cursad;   \
                            better_ref = ref;   \
                            better_mvx = mvx + x_offset;    \
                            better_mvy = mvy + y_offset;    \
                            /* need search more*/   \
                            stop = 0;   \
                        }
            // left
            CHECK_CANDIDATE(-1, 0, -1);
            // right
            CHECK_CANDIDATE(1, 0, 1);
            // top
            CHECK_CANDIDATE(0, -1, -stride_ref);
            // bottom
            CHECK_CANDIDATE(0, 1, stride_ref);
        }

        mvx = better_mvx;
        mvy = better_mvy;
        ref_st = better_ref;
        if (ABS(mvx) > limit_x || ABS(mvy) > limit_y)
        {
            break;
        }
    }

    // final mv
    context->vec_best.x = mvx << 2;
    context->vec_best.y = mvy << 2;
    // mostly we use sad as cmp function
    if (t->cmp[context->mb_part] == t->sad[context->mb_part])
        return sad;

    ref = ref_st + mvy * stride_ref + mvx;
    sad = t->cmp[context->mb_part](cur, stride_cur, ref, stride_ref) +
        t->mb.lambda * (eg_size_se(t->bs, context->vec_best.x - context->vec[0].x) + 
        eg_size_se(t->bs, context->vec_best.y - context->vec[0].y));
    return sad;
}

uint32_t 
square_diamond_search(T264_t* t, uint8_t* cur, uint8_t* ref_st, T264_search_context_t* context, int32_t stride_cur, int32_t stride_ref, uint32_t sad)
{
    int32_t limit_x = context->limit_x;
    int32_t limit_y = context->limit_y;
    //start mv
    int32_t mvx = context->vec_best.x >> 2;
    int32_t mvy = context->vec_best.y >> 2;
    // sad for start mv
    uint32_t cursad;
    uint8_t* ref;
    uint8_t stop = 0;
    uint8_t* better_ref;
    int32_t better_mvx;
    int32_t better_mvy;

    //	start mv is zero?
    if(mvx == 0 && mvy == 0)
        return small_diamond_search(t, cur, ref_st, context, stride_cur, stride_ref, sad);

    ref_st += mvy * stride_ref + mvx;

    better_mvx = mvx;
    better_mvy = mvy;
    better_ref = ref_st;

    while(!stop)
    {
        stop = 1;

        // search 8 points of sdsp
        {
            // left
            CHECK_CANDIDATE(-1, 0, -1);
            // right
            CHECK_CANDIDATE(1, 0, 1);
            // top-left
            CHECK_CANDIDATE(-1, -1, -stride_ref - 1);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆中文一区二区| 成人h动漫精品一区二区| 中文字幕免费观看一区| 欧美伊人精品成人久久综合97| 另类综合日韩欧美亚洲| 一区二区三区四区av| 国产日韩精品一区二区三区| 欧美精品丝袜久久久中文字幕| 成人午夜在线播放| 久久成人久久爱| 香蕉成人啪国产精品视频综合网| 中文字幕精品综合| 精品少妇一区二区三区在线播放 | 日日欢夜夜爽一区| 亚洲色大成网站www久久九九| 2020国产精品久久精品美国| 欧美日韩另类国产亚洲欧美一级| 99久久777色| 国产a精品视频| 国产精一品亚洲二区在线视频| 亚洲成a人v欧美综合天堂下载 | 91麻豆精品国产91久久久更新时间 | 色丁香久综合在线久综合在线观看| 麻豆精品久久精品色综合| 亚洲午夜国产一区99re久久| |精品福利一区二区三区| 国产日本一区二区| 国产视频一区二区三区在线观看| 日韩免费高清电影| 欧美一区中文字幕| 91精品综合久久久久久| 欧美三级在线播放| 欧美日韩国产综合一区二区| 91精品福利在线| 欧美在线观看视频一区二区| 色美美综合视频| 欧美色老头old∨ideo| 欧美日韩电影在线播放| 欧美电影一区二区| 欧美一区二区三区喷汁尤物| 欧美精品在线一区二区| 欧美一区二区久久久| 日韩一区二区在线观看视频| 欧美一区二区视频免费观看| 欧美电影一区二区三区| 91精品国产全国免费观看| 在线影院国内精品| 国产资源精品在线观看| 精品一区精品二区高清| 捆绑调教一区二区三区| 日韩va亚洲va欧美va久久| 天涯成人国产亚洲精品一区av| 亚洲一区二区三区免费视频| 亚洲国产三级在线| 亚洲一区二区三区四区五区中文| 国产精品资源在线观看| 日韩成人免费电影| 日韩国产欧美三级| 免费在线观看一区| 麻豆91在线看| 狠狠色综合色综合网络| 狠狠久久亚洲欧美| 99久久久免费精品国产一区二区| 91亚洲永久精品| 欧美日韩国产成人在线91| 制服丝袜一区二区三区| 久久久.com| 亚洲欧洲精品一区二区精品久久久| 亚洲图片自拍偷拍| 日本美女视频一区二区| 国产91精品精华液一区二区三区| 成人国产亚洲欧美成人综合网 | 国产一区二区91| 高清不卡一区二区| 欧美午夜电影在线播放| 欧美高清www午色夜在线视频| 精品盗摄一区二区三区| 国产日产欧美一区二区视频| 亚洲自拍与偷拍| 免费观看91视频大全| 成人免费av资源| 91国偷自产一区二区三区观看 | 丝袜a∨在线一区二区三区不卡 | 日韩国产欧美三级| 成人高清免费观看| 欧美日韩国产综合视频在线观看| 国产亚洲欧洲997久久综合| 亚洲欧洲精品天堂一级 | 欧美激情一区二区三区四区| 一区二区三区四区乱视频| 欧美aaaaaa午夜精品| 一本大道久久a久久精二百| 欧美日本一区二区三区| 国产精品久久久久久久久免费桃花 | 精品少妇一区二区三区在线视频| 亚洲三级电影网站| 日本三级韩国三级欧美三级| 成人午夜伦理影院| 宅男噜噜噜66一区二区66| 一本久道久久综合中文字幕| 欧美刺激午夜性久久久久久久 | 亚洲观看高清完整版在线观看| 亚洲视频精选在线| 国产一区二区三区香蕉 | av在线一区二区| 欧美一区二区三区日韩视频| 一区二区三区精品视频| 国产一区二区在线免费观看| 欧美一级日韩一级| 亚洲免费看黄网站| 暴力调教一区二区三区| 亚洲大尺度视频在线观看| 91碰在线视频| 精品国产伦一区二区三区观看方式 | 日本一道高清亚洲日美韩| 91久久精品一区二区二区| 国产色91在线| 国产一区二区免费看| 欧美人妖巨大在线| 亚洲一区二区综合| 国产xxx精品视频大全| 久久精品一区蜜桃臀影院| 午夜精品久久久久久久99水蜜桃 | 全部av―极品视觉盛宴亚洲| 99re66热这里只有精品3直播| 精品剧情v国产在线观看在线| 亚洲国产成人高清精品| 色婷婷av久久久久久久| 国产精品成人在线观看| 不卡电影一区二区三区| 日韩一区二区不卡| 麻豆一区二区三| 色婷婷综合五月| 国产日韩三级在线| 国产综合久久久久影院| 欧美成人一区二区三区在线观看| 久久成人18免费观看| 制服丝袜中文字幕亚洲| 美国十次综合导航| 欧美性感一区二区三区| 亚洲成av人综合在线观看| 91丨九色丨黑人外教| 亚洲精品福利视频网站| www.成人在线| 亚洲欧美在线另类| 91久久精品一区二区三| 亚洲最快最全在线视频| 欧美精品在线观看播放| 调教+趴+乳夹+国产+精品| 欧美大片日本大片免费观看| 久久99久久99| 中文字幕成人在线观看| 成人久久久精品乱码一区二区三区| 中文字幕中文在线不卡住| 99久久综合国产精品| 亚洲小说欧美激情另类| 在线观看免费视频综合| 日本伊人精品一区二区三区观看方式| 成人91在线观看| 亚洲成人一区在线| 欧美成人精品福利| 国产成人亚洲综合a∨婷婷图片 | 亚洲久草在线视频| 色综合中文综合网| 欧美一级夜夜爽| 黄色资源网久久资源365| 韩国精品一区二区| 久久久不卡网国产精品二区| 国产伦精一区二区三区| 2017欧美狠狠色| 99久久精品费精品国产一区二区| 亚洲一区二区不卡免费| 日韩一区二区视频| 国产一区二区三区国产| 久久婷婷国产综合精品青草| 粉嫩蜜臀av国产精品网站| 成人免费视频在线观看| 欧美一级生活片| 成人午夜精品在线| 热久久一区二区| 国产精品视频麻豆| 91精品国产欧美一区二区成人| 麻豆精品蜜桃视频网站| 中文字幕欧美一| 精品国产乱码久久久久久闺蜜| 成+人+亚洲+综合天堂| 免费成人在线网站| 国产精品国产三级国产aⅴ中文| 91精品国产综合久久蜜臀 | 日韩精品一区二区在线| 欧美大片免费久久精品三p| 日韩欧美国产高清| 日本一区二区三级电影在线观看| 中文字幕第一页久久| 国产午夜精品美女毛片视频| 国产精品色眯眯| 亚洲人成人一区二区在线观看| 亚洲天堂成人网| 爽好多水快深点欧美视频| 久久99精品久久久久久|