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

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

?? estimation.c

?? 文件為H.264編解碼器 僅供參考 包括windows版本和DM642版本
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*****************************************************************************
*
*  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);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美午夜影院一区| 国产精品盗摄一区二区三区| 国产欧美日韩在线看| 亚洲永久精品国产| 精品一区二区三区免费| 色美美综合视频| 国产女主播在线一区二区| 日韩在线一区二区三区| 色婷婷激情久久| 国产亚洲精品超碰| 蜜桃久久精品一区二区| 欧美午夜精品一区二区蜜桃| 国产色综合久久| 国产一区二区三区在线观看免费| 欧美亚洲国产怡红院影院| 欧美激情一二三区| 精久久久久久久久久久| 6080日韩午夜伦伦午夜伦| 日韩一区在线免费观看| 国产高清无密码一区二区三区| 欧美日韩在线免费视频| 亚洲精品一二三四区| av亚洲精华国产精华精| 欧美激情一区三区| 国产福利电影一区二区三区| 精品99久久久久久| 日本不卡一二三区黄网| 欧美精品自拍偷拍动漫精品| 曰韩精品一区二区| 91久久精品网| 伊人色综合久久天天| 色综合久久综合网欧美综合网 | 另类小说综合欧美亚洲| 欧美日韩国产高清一区二区三区| 亚洲在线免费播放| 欧美系列日韩一区| 丝袜美腿高跟呻吟高潮一区| 欧美日韩国产免费| 日日摸夜夜添夜夜添精品视频| 欧美疯狂性受xxxxx喷水图片| 午夜精品久久久久久久蜜桃app| 在线观看91精品国产入口| 亚洲一区二区三区在线播放| 欧美日韩一区高清| 青青青爽久久午夜综合久久午夜| 日韩欧美在线网站| 国产精品一区免费在线观看| 国产精品电影院| 在线亚洲一区二区| 亚洲国产精品久久久男人的天堂 | 99久久国产综合色|国产精品| 中文字幕在线不卡一区| 在线观看一区日韩| 麻豆成人91精品二区三区| 久久这里只精品最新地址| 成人小视频在线| 夜夜操天天操亚洲| 欧美成人免费网站| 成人免费视频国产在线观看| 亚洲一二三四区| 亚洲欧美在线视频观看| 欧美色倩网站大全免费| 久久99热国产| 自拍偷在线精品自拍偷无码专区| 欧美日韩精品高清| 国产成人综合网站| 亚洲电影在线播放| 久久精品人人做人人综合| 色成人在线视频| 久久99在线观看| 亚洲欧美日韩系列| 91.com在线观看| 成人免费视频网站在线观看| 日韩精品免费专区| 国产精品久久久久毛片软件| 日韩一区二区在线观看视频播放| 成人ar影院免费观看视频| 亚洲国产成人av| 中文字幕欧美区| 欧美一区二区成人6969| 99视频一区二区| 久久精品国产精品亚洲精品| 夜色激情一区二区| 国产精品全国免费观看高清| 欧美r级在线观看| 欧美做爰猛烈大尺度电影无法无天| 国产酒店精品激情| 三级不卡在线观看| 亚洲精品一二三| 国产欧美日韩精品一区| 日韩网站在线看片你懂的| 色爱区综合激月婷婷| 国产98色在线|日韩| 久久精品72免费观看| 亚洲国产精品久久不卡毛片| 国产精品国产三级国产aⅴ中文 | 欧美色综合久久| 丁香六月综合激情| 精品一区二区三区不卡 | 日韩一区二区视频| 在线精品视频免费播放| 97精品国产露脸对白| 粉嫩久久99精品久久久久久夜| 理论电影国产精品| 男女视频一区二区| 日韩中文字幕区一区有砖一区 | 欧美偷拍一区二区| 一本高清dvd不卡在线观看| 成人性色生活片免费看爆迷你毛片| 国产一区欧美日韩| 国产在线不卡一区| 精品一区二区三区免费视频| 奇米四色…亚洲| 秋霞国产午夜精品免费视频| 日韩国产一区二| 蜜臀久久99精品久久久画质超高清 | 性欧美大战久久久久久久久| 一区二区三区不卡视频在线观看| 综合网在线视频| 亚洲精品视频在线观看免费| 亚洲裸体在线观看| 亚洲精品欧美综合四区| 亚洲精品自拍动漫在线| 中文字幕亚洲综合久久菠萝蜜| 中文字幕在线观看不卡| 亚洲美女免费在线| 五月婷婷激情综合网| 日韩专区一卡二卡| 韩国欧美国产一区| 国产成人丝袜美腿| 91丨porny丨首页| 欧美性一级生活| 日韩欧美国产不卡| 久久综合色鬼综合色| 中文天堂在线一区| 亚洲影视在线播放| 奇米888四色在线精品| 精品一区二区久久| 成人黄色av电影| 欧美午夜精品电影| 精品少妇一区二区三区免费观看| 国产亚洲福利社区一区| 国产精品久久看| 亚洲综合免费观看高清完整版| 婷婷久久综合九色综合绿巨人| 久久99精品视频| 91丝袜美腿高跟国产极品老师| 欧美精品一二三区| 国产日韩欧美制服另类| 一区二区三区免费| 蜜桃视频一区二区三区| aaa欧美色吧激情视频| 在线播放欧美女士性生活| 国产性色一区二区| 亚洲国产成人高清精品| 国产精品一区二区视频| 在线亚洲免费视频| 久久精品人人做人人综合 | 狠狠色狠狠色综合日日91app| av成人免费在线观看| 日韩午夜av电影| 亚洲欧美日韩国产综合| 精品在线视频一区| 91国产福利在线| 国产欧美精品国产国产专区 | 精品一区二区三区视频在线观看| 99精品视频在线播放观看| 91精品国产91久久久久久最新毛片| 国产精品久久精品日日| 蜜臀av亚洲一区中文字幕| 91精彩视频在线| 国产嫩草影院久久久久| 美女视频第一区二区三区免费观看网站| 东方欧美亚洲色图在线| 欧美成人三级在线| 亚洲午夜精品在线| 91在线无精精品入口| 久久日韩粉嫩一区二区三区| 天天操天天干天天综合网| 91在线观看地址| 中文字幕第一区| 国产一区二区三区免费播放| 欧美一区二区视频在线观看2020| 亚洲美女视频在线| 99精品国产99久久久久久白柏| 久久精品一区二区三区不卡牛牛| 蜜桃久久av一区| 777午夜精品视频在线播放| 一区二区三区四区在线免费观看| 成人18精品视频| 国产校园另类小说区| 韩国v欧美v日本v亚洲v| 日韩欧美aaaaaa| 久久99国内精品| 欧美一区二区三区影视| 婷婷成人激情在线网| 欧美日韩视频第一区| 亚洲一区二区欧美激情| 欧美一a一片一级一片| 亚洲一区二区三区中文字幕 |