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

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

?? estimation.c

?? 經(jīng)過開源的H.264壓縮算法代碼
?? 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"

#include "memory.h"

#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一区二区三区免费野_久草精品视频
国产精品一级二级三级| 久久成人18免费观看| 精品三级av在线| 色噜噜狠狠色综合中国| 精品综合免费视频观看| 成人欧美一区二区三区白人| 日韩精品一区在线| 欧美午夜精品久久久久久超碰| 国产一区在线看| 天堂精品中文字幕在线| 中文字幕第一区综合| 日韩一区二区在线播放| 欧美在线免费视屏| 风流少妇一区二区| 国产精品1区2区| 日韩精品电影一区亚洲| 亚洲一区二区三区四区在线观看| 亚洲精品一线二线三线无人区| 欧美四级电影网| aaa欧美大片| youjizz久久| 国产91综合网| 成人性生交大片免费看中文| 国产一区二区美女诱惑| 国内精品国产成人国产三级粉色| 亚洲v日本v欧美v久久精品| 亚洲裸体在线观看| 亚洲精品欧美二区三区中文字幕| 亚洲国产高清在线观看视频| 国产精品另类一区| 一区二区三区美女视频| 免费在线欧美视频| 国产成人在线视频网站| 欧美性受极品xxxx喷水| 日韩精品一区二区三区在线观看 | 国产精品1区2区| 色综合久久综合中文综合网| 91精品午夜视频| 国产精品乱码久久久久久| 午夜欧美电影在线观看| 国产精品91一区二区| 一本大道av伊人久久综合| 91麻豆精品国产91久久久| 亚洲国产成人一区二区三区| 午夜精品久久久久久久蜜桃app | 国产乱码字幕精品高清av| 91浏览器在线视频| 欧美va亚洲va香蕉在线| 一区二区三区日韩欧美| 国产激情偷乱视频一区二区三区| 在线观看一区二区精品视频| 国产欧美日韩综合| 久久狠狠亚洲综合| 91麻豆精品国产自产在线| 国产精品久久久久aaaa樱花| 麻豆专区一区二区三区四区五区| 91影视在线播放| 国产精品激情偷乱一区二区∴| 麻豆久久久久久| 欧美一区三区四区| 亚洲韩国一区二区三区| 91国偷自产一区二区三区成为亚洲经典 | 捆绑变态av一区二区三区| 欧美日韩一卡二卡| 亚洲国产精品久久不卡毛片 | 一区二区三区蜜桃| 91久久精品国产91性色tv| 亚洲另类在线一区| 91免费版在线| 亚洲一本大道在线| 欧美精品tushy高清| 亚洲国产日韩精品| 欧美久久一二区| 日本欧美在线看| 精品sm在线观看| 高清在线成人网| 亚洲色图欧美激情| 91麻豆国产福利在线观看| 亚洲综合999| 日韩视频免费观看高清完整版 | 成人中文字幕电影| 亚洲人成7777| 欧美一区二区三区电影| 精品一区二区在线免费观看| 亚洲欧美中日韩| 欧美日韩中文字幕一区| 国产福利精品一区二区| 亚洲三级在线免费观看| 538prom精品视频线放| 国产成人亚洲综合a∨婷婷| 亚洲视频狠狠干| 精品88久久久久88久久久| 99vv1com这只有精品| 水野朝阳av一区二区三区| 亚洲国产精品精华液ab| 欧美日韩国产高清一区二区三区| 国产精品一区二区x88av| 亚洲三级久久久| 2021国产精品久久精品| 欧美在线观看视频一区二区三区| 狠狠色狠狠色合久久伊人| 亚洲黄色免费电影| 国产精品久久午夜夜伦鲁鲁| 日韩视频免费直播| 欧美理论片在线| 91免费看视频| 99久久久无码国产精品| 国产麻豆欧美日韩一区| 日本欧美大码aⅴ在线播放| 亚洲精品中文字幕乱码三区| 国产午夜精品一区二区三区四区| 欧美日韩国产免费一区二区 | 日韩午夜在线观看| 91精品国产综合久久精品性色| 99v久久综合狠狠综合久久| 国产91在线观看丝袜| 国产真实精品久久二三区| 美女视频免费一区| 日本人妖一区二区| 免费在线观看日韩欧美| 青青草国产精品亚洲专区无| 亚洲一区二区三区四区的| 亚洲电影你懂得| 日韩国产在线一| 另类专区欧美蜜桃臀第一页| 精品在线播放午夜| 国产精品一二三四| gogo大胆日本视频一区| 91小视频在线观看| 欧美天堂亚洲电影院在线播放| 欧美性生活久久| 欧美高清精品3d| 精品人伦一区二区色婷婷| 国产精品视频一二三| 亚洲午夜成aⅴ人片| 久久电影网电视剧免费观看| 懂色av一区二区三区蜜臀| 99久久国产综合精品色伊| 欧美三级日韩在线| www国产亚洲精品久久麻豆| 亚洲欧美自拍偷拍色图| 日本欧美一区二区三区乱码| 成熟亚洲日本毛茸茸凸凹| 欧美私模裸体表演在线观看| 欧美va亚洲va香蕉在线| 尤物av一区二区| 国产精品一区二区你懂的| 欧美网站一区二区| 中文字幕乱码亚洲精品一区| 五月天国产精品| 99久久综合色| 欧美一级专区免费大片| 国产欧美日韩精品a在线观看| 亚洲一区二区三区四区五区中文| 国产很黄免费观看久久| 欧美一区二区三区在线观看 | 97国产精品videossex| 日韩精品在线一区| 日日夜夜一区二区| 欧美性一区二区| 亚洲精品一二三| 成人成人成人在线视频| 日韩一区二区三区四区五区六区| 一区二区免费视频| 日本久久电影网| 综合av第一页| 99这里都是精品| 综合婷婷亚洲小说| 91麻豆免费看| 亚洲成人777| 91精品福利在线一区二区三区| 亚洲国产cao| 6080yy午夜一二三区久久| 琪琪久久久久日韩精品| 欧美v日韩v国产v| 国内精品伊人久久久久av一坑 | 久久亚洲欧美国产精品乐播 | 大桥未久av一区二区三区中文| 国产日韩在线不卡| 99久久国产免费看| 亚洲成人av电影| 久久精品日产第一区二区三区高清版 | 在线电影欧美成精品| 日本不卡视频一二三区| 国产午夜精品久久| 色噜噜夜夜夜综合网| 日本在线播放一区二区三区| 2021中文字幕一区亚洲| 99国产精品久久久久久久久久| 亚洲国产综合色| 久久久久久免费| 在线观看视频一区二区欧美日韩| 日精品一区二区| 国产精品伦理在线| 日韩视频在线永久播放| 成人免费高清视频在线观看| 五月综合激情日本mⅴ| 国产欧美va欧美不卡在线| 欧美日本一区二区在线观看| 国产成人在线观看|