• 428 x264_reference_update


    1.

    X264_Reference_update和x264_reference_build_list( h, h->fdec->i_poc );之前

    printf("[%d][%d][%d][%d]=======",h->i_frame,h->fenc->i_frame,h->fdec->i_frame,h->fenc->i_type );

    没有b帧的情况下,h->i_frame和h->fenc->i_frame同步,h->fenc->i_frame比h->fdec->i_frame

    大一,也就是每编一帧重建之后赋值给fdec作为重建帧,来后续使用。此过程发生在38帧之前。

    当有b帧的时候,排序过程就不是这样了。而且在这里类型已经决定了

    2.在x264_reference_update()函数中 第一个判定条件

    static inline int x264_reference_update( x264_t *h )

    {

             static updata_counter = 1;

        if( !h->fdec->b_kept_as_ref )

        {

            if( h->i_thread_frames > 1 )

            {

                x264_frame_push_unused( h, h->fdec );

                                printf("[%d][%d][%d]\n",h->i_frame,h->fdec->i_frame,h->fdec->b_fdec);

                                h->fdec = x264_frame_pop_unused( h, 1 );

                if( !h->fdec )

                    return -1;

            }

            return 0;

    }

    在我想来这里应该对于每一个帧都是成立的,但是打印出来信息不是这样的,第一帧成立然后开始序列为 41 39 1==43 41 1==这样的,这个是专门b帧的,最后又打印出来每一个类型信息f->fdec->i_type 每一个都是5.这个判定条件的意义不是很明确。

    有点迷惑unused[1]中进行的push和pop操作,但是都是先进先出的,这里等于是对每一个操作做了个出入操作。。。。没看懂

    网上有一个整体解释,看明白了,但是仍然有点不太明白作用。再次分析

    static inline int x264_reference_update( x264_t *h )

    {

             static updata_counter = 1;

        if( !h->fdec->b_kept_as_ref )

        {

            if( h->i_thread_frames > 1 )

            {

                x264_frame_push_unused( h, h->fdec );

                                printf("[%d][%d][%d]\n",h->i_frame,h->fdec->i_frame,h->fdec->b_fdec);

                                h->fdec = x264_frame_pop_unused( h, 1 );

                if( !h->fdec )

                    return -1;

            }

            return 0;

    }

    首先进来的都是b帧,确定里面参考帧数为1的放入unused[1]重建帧队列中,然后再从unused[1]参考帧队列中弹出来一帧。在刚才x264_frame_push_unused()中有一个判断条件

    Frame->i_reference_count>0参考帧数要大于不为0,frame->i_refrence_count—之后判断其是否为0,就是为了断定是否frame->i_reference_count是否为1.

    3.然后的步骤就是讲f->fdec放入reference中,这里就解释了到b帧的时候fdec->i_frame

    和h->fenc->i_frame在也不保持一直的原因。上面那个过程等于是做了个缓存,明白操作,但是具体为什么这么做要在后来联系起来解释。

    x264_frame_push( h->frames.reference, h->fdec );

        if( h->frames.reference[h->sps->i_num_ref_frames] )

            x264_frame_push_unused( h, x264_frame_shift( h->frames.reference ) );

        h->fdec = x264_frame_pop_unused( h, 1 );

        if( !h->fdec )

            return -1;

        return 0;

    4,。中间缺少一个东西完全找不到信息的东西

    /* apply mmco from previous frame. */

        for( int i = 0; i < h->sh.i_mmco_command_count; i++ )

            for( int j = 0; h->frames.reference[j]; j++ )

                if( h->frames.reference[j]->i_poc == h->sh.mmco[i].i_poc )

                    x264_frame_push_unused( h, x264_frame_shift( &h->frames.reference[j] ) );

    这个过程,完全找不到中文资料。等下再解决

  • 相关阅读:
    面试准备专题——JVM,类编译,类加载,内存错误
    面试准备-基础知识总结
    J2EE异常问题总结
    Java工具类使用注意事项
    高性能大型网站性能优化基础
    Spring Boot 2 (三):Spring Boot 开源软件都有哪些?
    Spring Boot 2(一):【重磅】Spring Boot 2.0权威发布
    Spring Boot 2 (二):Spring Boot 2 尝鲜-动态 Banner
    MFC对话框使用CPrintDialog实现打印,指定打印机、后台打印
    stm32实现iap远程固件更新
  • 原文地址:https://www.cnblogs.com/hatreds/p/2474719.html
Copyright © 2020-2023  润新知