Commit 5343740d authored by Austin Yuan's avatar Austin Yuan

vatrace: print MPEG4/H263 encode parameters information

Change-Id: Ib39b436865c2b665dc49c916d5f364f03e8c79b5
igned-off-by: default avatarAustin Yuan <shengquan.yuan@gmail.com>
parent 24ffa0da
#include <ui/DisplayInfo.h>
namespace android {
class Test {
......@@ -8,25 +9,32 @@ namespace android {
};
};
#define min(a,b) (a<b?a:b)
#define SURFACE_CREATE(client,surface_ctrl,android_surface, android_isurface, win_width, win_height) \
do {\
client = new SurfaceComposerClient();\
surface_ctrl = client->createSurface(getpid(), 0, win_width, win_height, PIXEL_FORMAT_RGB_565, ISurfaceComposer::ePushBuffers);\
android_surface = surface_ctrl->getSurface();\
android_isurface = Test::getISurface(android_surface);\
\
client->openTransaction();\
surface_ctrl->setPosition(0, 0);\
client->closeTransaction();\
\
client->openTransaction();\
surface_ctrl->setSize(win_width, win_height);\
client->closeTransaction();\
\
client->openTransaction();\
surface_ctrl->setLayer(0x100000);\
client->closeTransaction();\
\
} while (0) \
do { \
client = new SurfaceComposerClient(); \
android::DisplayInfo info; \
int w, h; \
\
client->getDisplayInfo(android::DisplayID(0), &info); \
w = min(win_width, info.w); \
h = min(win_height, info.h); \
\
surface_ctrl = client->createSurface(getpid(), 0, w, h, PIXEL_FORMAT_RGB_565, ISurfaceComposer::ePushBuffers); \
android_surface = surface_ctrl->getSurface(); \
android_isurface = Test::getISurface(android_surface); \
\
client->openTransaction(); \
surface_ctrl->setPosition(0, 0); \
client->closeTransaction(); \
\
client->openTransaction(); \
surface_ctrl->setSize(w, h); \
client->closeTransaction(); \
\
client->openTransaction(); \
surface_ctrl->setLayer(0x100000); \
client->closeTransaction(); \
} while (0)
......@@ -634,7 +634,7 @@ static void va_TraceVAPictureParameterBufferMPEG2(
VAPictureParameterBufferMPEG2 *p=(VAPictureParameterBufferMPEG2 *)data;
DPY2INDEX(dpy);
va_TraceMsg(idx,"VAPictureParameterBufferH264\n");
va_TraceMsg(idx,"VAPictureParameterBufferMPEG2\n");
va_TraceMsg(idx,"\thorizontal size= %d\n", p->horizontal_size);
va_TraceMsg(idx,"\tvertical size= %d\n", p->vertical_size);
......@@ -811,6 +811,67 @@ static void va_TraceVAIQMatrixBufferMPEG4(
return;
}
static void va_TraceVAEncSequenceParameterBufferMPEG4(
VADisplay dpy,
VAContextID context,
VABufferID buffer,
VABufferType type,
unsigned int size,
unsigned int num_elements,
void *data)
{
VAEncSequenceParameterBufferMPEG4 *p = (VAEncSequenceParameterBufferMPEG4 *)data;
DPY2INDEX(dpy);
va_TraceMsg(idx, "VAEncSequenceParameterBufferMPEG4\n");
va_TraceMsg(idx, "\tprofile_and_level_indication = %d\n", p->profile_and_level_indication);
va_TraceMsg(idx, "\tintra_period = %d\n", p->intra_period);
va_TraceMsg(idx, "\tvideo_object_layer_width = %d\n", p->video_object_layer_width);
va_TraceMsg(idx, "\tvideo_object_layer_height = %d\n", p->video_object_layer_height);
va_TraceMsg(idx, "\tvop_time_increment_resolution = %d\n", p->vop_time_increment_resolution);
va_TraceMsg(idx, "\tfixed_vop_rate = %d\n", p->fixed_vop_rate);
va_TraceMsg(idx, "\tfixed_vop_time_increment = %d\n", p->fixed_vop_time_increment);
va_TraceMsg(idx, "\tbits_per_second = %d\n", p->bits_per_second);
va_TraceMsg(idx, "\tframe_rate = %d\n", p->frame_rate);
va_TraceMsg(idx, "\tinitial_qp = %d\n", p->initial_qp);
va_TraceMsg(idx, "\tmin_qp = %d\n", p->min_qp);
va_TraceMsg(idx, NULL);
/* start a new sequce, coded log file can be truncated */
trace_context[idx].trace_sequence_start = 1;
return;
}
static void va_TraceVAEncPictureParameterBufferMPEG4(
VADisplay dpy,
VAContextID context,
VABufferID buffer,
VABufferType type,
unsigned int size,
unsigned int num_elements,
void *data)
{
VAEncPictureParameterBufferMPEG4 *p = (VAEncPictureParameterBufferMPEG4 *)data;
DPY2INDEX(dpy);
va_TraceMsg(idx, "VAEncPictureParameterBufferMPEG4\n");
va_TraceMsg(idx, "\treference_picture = 0x%08x\n", p->reference_picture);
va_TraceMsg(idx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
va_TraceMsg(idx, "\tcoded_buf = %08x\n", p->coded_buf);
va_TraceMsg(idx, "\tpicture_width = %d\n", p->picture_width);
va_TraceMsg(idx, "\tpicture_height = %d\n", p->picture_height);
va_TraceMsg(idx, "\tmodulo_time_base = %d\n", p->modulo_time_base);
va_TraceMsg(idx, "\tvop_time_increment = %d\n", p->vop_time_increment);
va_TraceMsg(idx, "\tpicture_type = %d\n", p->picture_type);
va_TraceMsg(idx, NULL);
trace_context[idx].trace_codedbuf = p->coded_buf;
return;
}
static void va_TraceVASliceParameterBufferMPEG4(
VADisplay dpy,
......@@ -1410,6 +1471,101 @@ static void va_TraceMPEG2Buf(
}
}
static void va_TraceVAEncSequenceParameterBufferH263(
VADisplay dpy,
VAContextID context,
VABufferID buffer,
VABufferType type,
unsigned int size,
unsigned int num_elements,
void *data)
{
VAEncSequenceParameterBufferH263 *p = (VAEncSequenceParameterBufferH263 *)data;
DPY2INDEX(dpy);
va_TraceMsg(idx, "VAEncSequenceParameterBufferH263\n");
va_TraceMsg(idx, "\tintra_period = %d\n", p->intra_period);
va_TraceMsg(idx, "\tbits_per_second = %d\n", p->bits_per_second);
va_TraceMsg(idx, "\tframe_rate = %d\n", p->frame_rate);
va_TraceMsg(idx, "\tinitial_qp = %d\n", p->initial_qp);
va_TraceMsg(idx, "\tmin_qp = %d\n", p->min_qp);
va_TraceMsg(idx, NULL);
/* start a new sequce, coded log file can be truncated */
trace_context[idx].trace_sequence_start = 1;
return;
}
static void va_TraceVAEncPictureParameterBufferH263(
VADisplay dpy,
VAContextID context,
VABufferID buffer,
VABufferType type,
unsigned int size,
unsigned int num_elements,
void *data)
{
VAEncPictureParameterBufferH263 *p = (VAEncPictureParameterBufferH263 *)data;
DPY2INDEX(dpy);
va_TraceMsg(idx, "VAEncPictureParameterBufferH263\n");
va_TraceMsg(idx, "\treference_picture = 0x%08x\n", p->reference_picture);
va_TraceMsg(idx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
va_TraceMsg(idx, "\tcoded_buf = %08x\n", p->coded_buf);
va_TraceMsg(idx, "\tpicture_width = %d\n", p->picture_width);
va_TraceMsg(idx, "\tpicture_height = %d\n", p->picture_height);
va_TraceMsg(idx, "\tpicture_type = 0x%08x\n", p->picture_type);
va_TraceMsg(idx, NULL);
trace_context[idx].trace_codedbuf = p->coded_buf;
return;
}
static void va_TraceH263Buf(
VADisplay dpy,
VAContextID context,
VABufferID buffer,
VABufferType type,
unsigned int size,
unsigned int num_elements,
void *pbuf
)
{
switch (type) {
case VAPictureParameterBufferType:
case VAIQMatrixBufferType:
case VABitPlaneBufferType:
case VASliceGroupMapBufferType:
case VASliceParameterBufferType:
case VASliceDataBufferType:
case VAMacroblockParameterBufferType:
case VAResidualDataBufferType:
case VADeblockingParameterBufferType:
case VAImageBufferType:
case VAProtectedSliceDataBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break;
case VAEncCodedBufferType:
break;
case VAEncSequenceParameterBufferType:
va_TraceVAEncSequenceParameterBufferH263(dpy, context, buffer, type, size, num_elements, pbuf);
break;
case VAEncPictureParameterBufferType:
va_TraceVAEncPictureParameterBufferH263(dpy, context, buffer, type, size, num_elements, pbuf);
break;
case VAEncSliceParameterBufferType:
va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
break;
default:
break;
}
}
static void va_TraceMPEG4Buf(
VADisplay dpy,
VAContextID context,
......@@ -1455,10 +1611,10 @@ static void va_TraceMPEG4Buf(
case VAEncCodedBufferType:
break;
case VAEncSequenceParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
va_TraceVAEncSequenceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
break;
case VAEncPictureParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
va_TraceVAEncPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
break;
case VAEncSliceParameterBufferType:
va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
......@@ -1640,7 +1796,7 @@ void va_TraceRenderPicture(
case VAProfileMPEG2Simple:
case VAProfileMPEG2Main:
for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t------------------", j);
va_TraceMsg(idx, "\t---------------------------\n", j);
va_TraceMsg(idx, "\telement[%d] = ", j);
va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
......@@ -1649,7 +1805,7 @@ void va_TraceRenderPicture(
case VAProfileMPEG4AdvancedSimple:
case VAProfileMPEG4Main:
for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t------------------", j);
va_TraceMsg(idx, "\t---------------------------\n", j);
va_TraceMsg(idx, "\telement[%d] = ", j);
va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment