⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enctrace.c

📁 freescale i.mx31 BSP CE5.0全部源码
💻 C
字号:
/*------------------------------------------------------------------------------
--                                                                            --
--       This software is confidential and proprietary and may be used        --
--        only as expressly authorized by a licensing agreement from          --
--                                                                            --
--                            Hantro Products Oy.                             --
--                                                                            --
--      In the event of publication, the following notice is applicable:      --
--                                                                            --
--                   (C) COPYRIGHT 2004 HANTRO PRODUCTS OY                    --
--                            ALL RIGHTS RESERVED                             --
--                                                                            --
--          The entire notice above must be reproduced on all copies.         --
--                                                                            --
--------------------------------------------------------------------------------
--
--  Description : Encoder internal
--
-------------------------------------------------------------------------------*/


/*------------------------------------------------------------------------------

    Table of context

    1. Include headers
    2. External compiler flags
    3. Module defines
    4. Local function prototypes
    5. Functions
        5.1  EncTraceImage

------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------
    1. Include headers
------------------------------------------------------------------------------*/
#include "EncTrace.h"
#ifdef TRACE_STREAM
#include <stdio.h>

/*------------------------------------------------------------------------------
    2. External compiler flags
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
    3. Module defines
------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------
    4. Local function prototypes
------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------

	EncTrace

------------------------------------------------------------------------------*/
bool_e EncTraceStream(i32 value, i32 number)
{
	FILE *file = NULL;
	i32 i;

	file = fopen("stream.trc", "ab");
	if (file == NULL) {
		fprintf(stderr, "Unable to open Stream file: stream.trc\n");
		return NOK;
	}

	/* Print binary value to trace file */
	fprintf(file, "\n");
	for (i = 0; i < number; i++) {
		if ((value & (1<<(number-i-1))) > 0) {
			fprintf(file, "1");
		} else {
			fprintf(file, "0");
		}
	}

	/* Fill empty area */
	for (i = number; i < 26; i++) {
		fprintf(file, " ");
	}

	fclose(file);

	return OK;
}


/*------------------------------------------------------------------------------

	EncComment

------------------------------------------------------------------------------*/
bool_e EncComment(char *comment)
{
	FILE *file = NULL;

	file = fopen("stream.trc", "ab");
	if (file == NULL) {
		fprintf(stderr, "Unable to open Stream file: stream.trc\n");
		return NOK;
	}

	fprintf(file, "%s", comment);

	fclose(file);

	return OK;
}

/*------------------------------------------------------------------------------

	EncPrintMbArray

------------------------------------------------------------------------------*/
bool_e EncPrintBlock(i32 *data, char *name)
{
	u32 i, j;
	FILE *file = NULL;

	file = fopen(name,"a");
	if (file == NULL) {
		fprintf(stderr,"Unable to open file: %s\n", name);
		return NOK;
	}

	for (i = 0; i < 8; i++) {
		for (j = 0; j < 8; j++) {
			fprintf(file,"%4d",data[j]);
		}
		fprintf(file,"\n");
		data += 8;
	}
	fprintf(file,"\n");
	fclose(file);

	return OK;
}

/*------------------------------------------------------------------------------

	EncPrintIndex

------------------------------------------------------------------------------*/
bool_e EncPrintIndex(i32 *index, char *name, i32 width, i32 height)
{
	i32 i, j;
	FILE *file = NULL;

	file = fopen(name,"a");
	if (file == NULL) {
		fprintf(stderr,"Unable to open file: %s\n", name);
		return NOK;
	}

	for (i = 0; i < height; i++) {
		for (j = 0; j < width; j++) {
			fprintf(file,"%5i", *index++);
		}
		fprintf(file,"\n");
	}
	fprintf(file,"\n");
	fclose(file);

	return OK;
}

/*------------------------------------------------------------------------------

	EncRcTrace

------------------------------------------------------------------------------*/
void EncRcTrace(rateControl_s *rc)
{
	i32 i;

	printf("RATE CONTROL ACTION BEFORE VOP:\n");

	/* Virtual buffer */
	printf("VIRTUAL BUFFER:\n");
	printf("bitPerVop\t\t%i\n", rc->virtualBuffer.bitPerVop);
	printf("realBitCnt\t\t%i\n",rc->virtualBuffer.realBitCnt);
	printf("bitAvailable\t\t%i\n",rc->virtualBuffer.bitAvailable);

	/* Souce model */
	printf("SOURCE MODEL:\n");
	printf("source param\t\t%f\n",rc->srcPrm/(float)256);
	printf("Scaler\t\t\t%f\n", (float)rc->scaler/256);
	printf("Vop qpHdr\t\t%i\n",rc->qpHdr);

	/* Check point */
	printf("CHECK POINT:\n");
	for (i = 0; i < CHECK_POINT; i++) {
		printf("ChekPoint %6i wordCntTarget %7i wordCntPrev  %3i\n",
				rc->qpCtrl.checkPoint[i],
				rc->qpCtrl.wordCntTarget[i],
				rc->qpCtrl.wordCntPrev[i]);
	}
	for (i = 0; i < CTRL_CNT; i++) {
		printf("wordError %7i qpChange %3i\n", rc->qpCtrl.wordError[i],
				rc->qpCtrl.qpChange[i]);
	}

	/* Final status */
	printf("FINAL STATUS:\n");
	printf("Vop type current\t%i\n",rc->vopTypeCur);
	printf("Vop coded\t\t%i\n",rc->vopCoded);
	printf("Vop header qp\t\t%i\n",rc->qpHdr);

	return;
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -