a new sample to decode all psp supported MP4AVC

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

a new sample to decode all psp supported MP4AVC

Post by cooleyes »

Here is a sample code to decode a psp mp4(avc) file.

full source package, you can download from here
http://cooleyes.fx-world.org/downloads/ ... ecoder.rar

Code: Select all

/* 
 *	Copyright (C) 2008 cooleyes
 *	eyes.cooleyes@gmail.com 
 *
 *  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, 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 GNU Make; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
 *  http://www.gnu.org/copyleft/gpl.html
 *
 */
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdisplay.h>
#include <psputils.h>
#include <pspgu.h>
#include <pspdebug.h>
#include <psppower.h>
#include <stdio.h>
#include <stdlib.h>
#include <psprtc.h>
#include <pspsdk.h>
#include <string.h>
#include <malloc.h>
#include "common/mem64.h"
#include "pspmpeg.h"
#include "mp4_read.h"

int SetupCallbacks&#40;&#41;;

PSP_MODULE_INFO&#40;"AVCDecoder", 0, 1, 1&#41;;
PSP_MAIN_THREAD_ATTR&#40;0&#41;;
PSP_HEAP_SIZE_KB&#40;18*1024&#41;;

SceCtrlData input;

typedef struct &#123;
	ScePVoid sps_buffer;
	SceInt32 sps_size;
	ScePVoid pps_buffer;
	SceInt32 pps_size;
	SceInt32 nal_prefix_size;
	ScePVoid nal_buffer;
	SceInt32 nal_size;
	SceInt32 mode;
&#125; Mp4AvcNalStruct;

typedef struct &#123;
	SceInt32 unknown0;
	SceInt32 unknown1;
	SceInt32 width;
	SceInt32 height;
	SceInt32 unknown4;
	SceInt32 unknown5;
	SceInt32 unknown6;
	SceInt32 unknown7;
	SceInt32 unknown8;
	SceInt32 unknown9;
&#125; Mp4AvcInfoStruct;

typedef struct &#123;
	ScePVoid buffer0;
	ScePVoid buffer1;
	ScePVoid buffer2;
	ScePVoid buffer3;
	ScePVoid buffer4;
	ScePVoid buffer5;
	ScePVoid buffer6;
	ScePVoid buffer7;
	SceInt32 unknown0;
	SceInt32 unknown1;
	SceInt32 unknown2;
&#125; Mp4AvcYuvStruct;


typedef struct &#123;
	SceInt32 unknown0;
	SceInt32 unknown1;
	SceInt32 unknown2;
	SceInt32 unknown3;
	Mp4AvcInfoStruct* info_buffer;
	SceInt32 unknown5;
	SceInt32 unknown6;
	SceInt32 unknown7;
	SceInt32 unknown8;
	SceInt32 unknown9;
	SceInt32 unknown10;
	Mp4AvcYuvStruct* yuv_buffer;
	SceInt32 unknown12;
	SceInt32 unknown13;
	SceInt32 unknown14;
	SceInt32 unknown15;
	SceInt32 unknown16;
	SceInt32 unknown17;
	SceInt32 unknown18;
	SceInt32 unknown19;
	SceInt32 unknown20;
	SceInt32 unknown21;
	SceInt32 unknown22;
	SceInt32 unknown23;
&#125; Mp4AvcDetail2Struct;

typedef struct &#123;
	SceInt32 height;
	SceInt32 width;
	SceInt32 mode0;
	SceInt32 mode1;
	ScePVoid buffer0;
	ScePVoid buffer1;
	ScePVoid buffer2;
	ScePVoid buffer3;
	ScePVoid buffer4;
	ScePVoid buffer5;
	ScePVoid buffer6;
	ScePVoid buffer7;
&#125; Mp4AvcCscStruct;

typedef struct &#123;
	int      mpeg_init;
	int      mpeg_create;
	ScePVoid mpeg_buffer;
	SceMpeg mpeg;
	SceMpegRingbuffer mpeg_ringbuffer;
	SceMpegAu* mpeg_au;
	SceInt32 mpeg_mode;
	SceInt32 mpeg_buffer_size;
	ScePVoid mpeg_ddrtop;
	ScePVoid mpeg_au_buffer;
	ScePVoid mpeg_sps_pps_buffer;
	SceInt32 mpeg_sps_size;
	SceInt32 mpeg_pps_size;
	SceInt32 mpeg_nal_prefix_size;
	Mp4AvcDetail2Struct* mpeg_detail2;
	SceInt32 mpeg_pic_num;
&#125; Mp4AvcDecoderStruct;


Mp4AvcDecoderStruct avc_struct;
Mp4AvcDecoderStruct* avc = &avc_struct;
Mp4AvcCscStruct csc_struct;
Mp4AvcCscStruct* csc = &csc_struct;

struct mp4_read_struct reader;

unsigned long __attribute__&#40;&#40;aligned&#40;64&#41;&#41;&#41; RGBBuffer0&#91;768*480&#93;;
unsigned long __attribute__&#40;&#40;aligned&#40;64&#41;&#41;&#41; RGBBuffer1&#91;768*480&#93;;
unsigned char* FrameBuffer&#91;&#93; = &#123;RGBBuffer0, RGBBuffer1&#125;;
int frame_index = 0;
char filename&#91;1024&#93;;


typedef struct tagBITMAPFILEHEADER &#123;
        unsigned long   bfSize;
        unsigned long   bfReserved;
        unsigned long   bfOffBits;
&#125; BITMAPFILEHEADER;

typedef struct tagBITMAPINFOHEADER&#123;
	unsigned long	biSize;
	long	biWidth;
	long	biHeight;
	unsigned short	biPlanes;
	unsigned short	biBitCount;
	unsigned long	biCompression;
	unsigned long	biSizeImage;
	long	biXPelsPerMeter;
	long	biYPelsPerMeter;
	unsigned long	biClrUsed;
	unsigned long	biClrImportant;
&#125; BITMAPINFOHEADER;

unsigned char bm&#91;2&#93; = &#123;0x42, 0x4D&#125;;
BITMAPFILEHEADER h1;
BITMAPINFOHEADER h2;

void convertRGBBuffer&#40;void* src, void* dest, int w, int h&#41; &#123;
	unsigned long* src_p = &#40;unsigned long*&#41;src;
	unsigned long* dest_p = &#40;unsigned long*&#41;dest;
	
	int x,y;
	unsigned long point;
	unsigned char a, b, g, r;
	for&#40;y = 0; y < h; y++&#41; &#123;
		for&#40;x = 0; x < w; x++ &#41; &#123;
			point = src_p&#91;y*w+x&#93;;
			a = &#40;unsigned char&#41;&#40; &#40; point >> 24 &#41; & 0xFF &#41;;
			b = &#40;unsigned char&#41;&#40; &#40; point >> 16 &#41; & 0xFF &#41;;
			g = &#40;unsigned char&#41;&#40; &#40; point >> 8 &#41; & 0xFF &#41;;
			r = &#40;unsigned char&#41;&#40; &#40; point &#41; & 0xFF &#41;;
			point = a;
			point = &#40;point << 8 &#41; | r;
			point = &#40;point << 8 &#41; | g;
			point = &#40;point << 8 &#41; | b; 
			dest_p&#91;&#40;h-1-y&#41;*w+x&#93; = point;
		&#125;
	&#125;
&#125;

int main&#40;void&#41;
&#123;
	SetupCallbacks&#40;&#41;;
	
	pspDebugScreenInit&#40;&#41;;
	pspDebugScreenSetXY&#40;0, 2&#41;;
	
	scePowerSetClockFrequency&#40;133,133,66&#41;;
	scePowerSetCpuClockFrequency&#40;133&#41;;
	scePowerSetBusClockFrequency&#40;66&#41;;
	u32 cpu = scePowerGetCpuClockFrequency&#40;&#41;;
	u32 bus = scePowerGetBusClockFrequency&#40;&#41;;
	
	pspDebugScreenPrintf&#40;"cpu=%d, bus=%d\n", cpu, bus&#41;;
	
	getcwd&#40;filename, 256&#41;;
	
	int devkitVersion = sceKernelDevkitVersion&#40;&#41;;
	if &#40; devkitVersion < 0x03050000&#41;
		strcat&#40;filename, "/mpeg_vsh330.prx"&#41;;
	else if &#40; devkitVersion < 0x03070000&#41;
		strcat&#40;filename, "/mpeg_vsh350.prx"&#41;;
	else
		strcat&#40;filename, "/mpeg_vsh370.prx"&#41;;
	
	pspDebugScreenPrintf&#40;"%s\n", filename&#41;;
	
	mp4_read_safe_constructor&#40;&reader&#41;;
	memset&#40;avc, 0, sizeof&#40;Mp4AvcDecoderStruct&#41;&#41;;
	
	int result;
	result = sceUtilityLoadAvModule&#40;0&#41;;
	if &#40; result < 0 &#41; &#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; sceUtilityLoadAvModule&#40;0&#41;\n"&#41;;
		goto wait;
	&#125;
	
	SceUID modid;
	int status;
	modid = sceKernelLoadModule&#40;filename, 0, NULL&#41;;
	if&#40;modid >= 0&#41; &#123;
		modid = sceKernelStartModule&#40;modid, 0, 0, &status, NULL&#41;;
	&#125;
	else &#123;
		pspDebugScreenPrintf&#40;"\nerr=0x%08X &#58; sceKernelLoadModule\n", modid&#41;;
		goto wait;
	&#125;
	
	
	getcwd&#40;filename, 256&#41;;
	strcat&#40;filename, "/cooleyesBridge.prx"&#41;;
	modid = sceKernelLoadModule&#40;filename, 0, NULL&#41;;
	if&#40;modid >= 0&#41; &#123;
		modid = sceKernelStartModule&#40;modid, 0, 0, &status, NULL&#41;;
	&#125;
	else &#123;
		pspDebugScreenPrintf&#40;"\nerr=0x%08X &#58; sceKernelLoadModule&#40;cooleyesBridge&#41;\n", modid&#41;;
		goto wait;
	&#125;
	
	char* res;
	res = mp4_read_open&#40;&reader, "ms0&#58;/VIDEO/Test.MP4"&#41;;
	if &#40; res &#41; &#123;
		pspDebugScreenPrintf&#40;"mp4_read_open &#58; %s\n", res&#41;;
		goto wait;
	&#125;
	
	pspDebugScreenPrintf&#40;"video width %d, height %d\n",
		reader.file.video_width,
		reader.file.video_height&#41;;
		
	if &#40; reader.file.info->tracks&#91;reader.file.video_track_id&#93;->avc_profile == 0x4D && 
		&#40;reader.file.video_width > 480 || reader.file.video_height > 272 &#41; &#41; &#123;
		//set ME to main profile 480P mode
		cooleyesMeBootStart&#40;devkitVersion, 1&#41;;
		avc->mpeg_mode = 5;
	&#125;
	else if &#40;reader.file.info->tracks&#91;reader.file.video_track_id&#93;->avc_profile == 0x4D &#41;&#123;
		//set ME to main profile mode &#40; <=480*272 &#41;
		cooleyesMeBootStart&#40;devkitVersion, 3&#41;;
		avc->mpeg_mode = 4;
	&#125;
	else if &#40; reader.file.info->tracks&#91;reader.file.video_track_id&#93;->avc_profile == 0x42 &#41; &#123;
		//set ME to baseline profile mode &#40; <=480*272 &#41;
		cooleyesMeBootStart&#40;devkitVersion, 4&#41;;
		avc->mpeg_mode = 4;
	&#125;
	
	result = sceMpegInit&#40;&#41;;
	if &#40; result != 0 &#41;&#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; sceMpegInit=0x%08X\n", result&#41;;
		goto wait;
	&#125;
	
	avc->mpeg_ddrtop =  memalign&#40;0x400000, 0x400000&#41;;
	avc->mpeg_au_buffer = avc->mpeg_ddrtop + 0x10000;

	
	result = sceMpegQueryMemSize&#40;avc->mpeg_mode&#41;;
	if &#40; result < 0 &#41;&#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; sceMpegQueryMemSize&#40;0x%08X&#41;=0x%08X\n", avc->mpeg_mode, result&#41;;
		goto wait;
	&#125;
	
	avc->mpeg_buffer_size = result;
	
	if &#40; &#40;result & 0xF&#41; != 0 &#41;
		result = &#40;result & 0xFFFFFFF0&#41; + 16;
			
	avc->mpeg_buffer = malloc_64&#40;result&#41;;
	if &#40; avc->mpeg_buffer == 0 &#41; &#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; alloc\n"&#41;;
		goto wait;
	&#125;
	
	result = sceMpegCreate&#40;&avc->mpeg, avc->mpeg_buffer, avc->mpeg_buffer_size, &avc->mpeg_ringbuffer, 512, avc->mpeg_mode, avc->mpeg_ddrtop&#41;;	
	if &#40; result != 0&#41;&#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; sceMpegCreate&#40;...&#41;=0x%08X\n", result&#41;;
		goto wait;
	&#125;
	
	avc->mpeg_au = &#40;SceMpegAu*&#41;malloc_64&#40;64&#41;;
	if &#40; avc->mpeg_au == 0 &#41; &#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; alloc\n"&#41;;
		goto wait;
	&#125;
	memset&#40;avc->mpeg_au, 0xFF, 64&#41;;
	if &#40; sceMpegInitAu&#40;&avc->mpeg, avc->mpeg_au_buffer, avc->mpeg_au&#41; != 0 &#41;&#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; sceMpegInitAu&#40;...&#41;=0x%08X\n", result&#41;;
		goto wait;
	&#125;
	
	unsigned char* nal_buffer = &#40;unsigned char*&#41;malloc_64&#40;1024*1024&#41;;
	
	pspDebugScreenPrintf&#40;"sps %d, pps %d, nal_prefix %d\n",
		reader.file.info->tracks&#91;reader.file.video_track_id&#93;->avc_sps_size,
		reader.file.info->tracks&#91;reader.file.video_track_id&#93;->avc_pps_size,
		reader.file.info->tracks&#91;reader.file.video_track_id&#93;->avc_nal_prefix_size&#41;;
	
	avc->mpeg_sps_size = reader.file.info->tracks&#91;reader.file.video_track_id&#93;->avc_sps_size;
	avc->mpeg_pps_size = reader.file.info->tracks&#91;reader.file.video_track_id&#93;->avc_pps_size;
	avc->mpeg_nal_prefix_size = reader.file.info->tracks&#91;reader.file.video_track_id&#93;->avc_nal_prefix_size;
	avc->mpeg_sps_pps_buffer = malloc_64&#40;avc->mpeg_sps_size + avc->mpeg_pps_size&#41;;
	if &#40; avc->mpeg_sps_pps_buffer == 0 &#41; &#123;
		goto wait;
	&#125;
	memcpy&#40;avc->mpeg_sps_pps_buffer, reader.file.info->tracks&#91;reader.file.video_track_id&#93;->avc_sps, avc->mpeg_sps_size&#41;;
	memcpy&#40;avc->mpeg_sps_pps_buffer+avc->mpeg_sps_size, reader.file.info->tracks&#91;reader.file.video_track_id&#93;->avc_pps, avc->mpeg_pps_size&#41;;
	
	
	Mp4AvcNalStruct nal;
	int frame_count = 0;
	int output_frame = 0;
	sceCtrlReadBufferPositive&#40;&input, 1&#41;;
	
	struct mp4_video_read_output_struct v_packet;

	
	while&#40;!&#40;input.Buttons & PSP_CTRL_TRIANGLE&#41;&#41; &#123;
		
		nal.sps_buffer = avc->mpeg_sps_pps_buffer;
		nal.sps_size = avc->mpeg_sps_size;
		nal.pps_buffer = avc->mpeg_sps_pps_buffer+avc->mpeg_sps_size;
		nal.pps_size = avc->mpeg_pps_size;
		nal.nal_prefix_size = avc->mpeg_nal_prefix_size;
		
		res = mp4_read_get_video&#40;&reader, frame_count, &v_packet&#41;;
		if &#40;res != 0&#41;
			break;
		
		nal.nal_buffer = v_packet.video_buffer;
		nal.nal_size = v_packet.video_length ;
		if &#40; frame_count == 0 &#41;
			nal.mode = 3;
		else
			nal.mode = 0;
	
		result = sceMpegGetAvcNalAu&#40;&avc->mpeg, &nal, avc->mpeg_au&#41;;
		pspDebugScreenPrintf&#40;" GetAvcNalAu=0x%08X\n", result&#41;;
	
		result = sceMpegAvcDecode&#40;&avc->mpeg, avc->mpeg_au, 512, 0, &avc->mpeg_pic_num&#41;;
		pspDebugScreenPrintf&#40;" AvcDecode=0x%08X,0x%08X\n", result, avc->mpeg_pic_num&#41;;
		
		result = sceMpegAvcDecodeDetail2&#40;&avc->mpeg, &avc->mpeg_detail2&#41;;
		pspDebugScreenPrintf&#40;" AvcDecodeDetail2=0x%08X, ErrCode=%d\n", result, avc->mpeg_detail2->unknown2&#41;;
		pspDebugScreenPrintf&#40;" Decode width=%d, height=%d\n", avc->mpeg_detail2->info_buffer->width, avc->mpeg_detail2->info_buffer->height&#41;;
		char rgb_filename&#91;512&#93;;
		if &#40; avc->mpeg_pic_num > 0 &#41; &#123;
			int i;
			for&#40; i = 0; i < avc->mpeg_pic_num; i++ &#41; &#123;
				Mp4AvcCscStruct csc;
				csc.height = &#40;avc->mpeg_detail2->info_buffer->height+15&#41; >> 4;
				csc.width = &#40;avc->mpeg_detail2->info_buffer->width+15&#41; >> 4;
				csc.mode0 = 0;
				csc.mode1 = 0;
				csc.buffer0 = avc->mpeg_detail2->yuv_buffer->buffer0 ;
				csc.buffer1 = avc->mpeg_detail2->yuv_buffer->buffer1 ;
				csc.buffer2 = avc->mpeg_detail2->yuv_buffer->buffer2 ;
				csc.buffer3 = avc->mpeg_detail2->yuv_buffer->buffer3 ;
				csc.buffer4 = avc->mpeg_detail2->yuv_buffer->buffer4 ;
				csc.buffer5 = avc->mpeg_detail2->yuv_buffer->buffer5 ;
				csc.buffer6 = avc->mpeg_detail2->yuv_buffer->buffer6 ;
				csc.buffer7 = avc->mpeg_detail2->yuv_buffer->buffer7 ;
				int csc_width = &#40;avc->mpeg_mode == 4&#41; ? 512 &#58; 768;
				int bmp_width = &#40;avc->mpeg_mode == 4&#41; ? 512 &#58; 768;
				int bmp_height = reader.file.video_height;
				if &#40; sceMpegBaseCscAvc&#40;RGBBuffer0, 0, csc_width, &csc&#41; == 0 &#41; &#123;
					memset&#40;rgb_filename, 0, 512&#41;;
					sprintf&#40;rgb_filename, "ms0&#58;/PICTURE/%dx%d.output_frame%d.bmp", 
						reader.file.video_width,
						reader.file.video_height,
						output_frame&#41;;
					output_frame++;
					FILE* fp_rgb = fopen&#40;rgb_filename, "wb"&#41;;
					
					fwrite&#40;bm, 2, 1, fp_rgb&#41;;
	
					h1.bfSize = 4 * bmp_width * bmp_height + sizeof&#40;BITMAPFILEHEADER&#41; + sizeof&#40;BITMAPINFOHEADER&#41; + 2;
					h1.bfReserved = 0;
					h1.bfOffBits = 2 + sizeof&#40;BITMAPFILEHEADER&#41; + sizeof&#40;BITMAPINFOHEADER&#41;;
				
					h2.biSize = sizeof&#40;BITMAPINFOHEADER&#41;;
					h2.biPlanes = 1;
					h2.biBitCount = 32;
					h2.biCompression = 0;
					h2.biWidth = bmp_width;
					h2.biHeight = bmp_height;
					h2.biSizeImage = 3 * bmp_width * bmp_height;
					h2.biXPelsPerMeter = 0xEC4;
					h2.biYPelsPerMeter = 0xEC4;
					h2.biClrUsed = 0;
					h2.biClrImportant = 0;
				
					fwrite&#40;&h1, sizeof&#40;BITMAPFILEHEADER&#41;, 1, fp_rgb&#41;;
					fwrite&#40;&h2, sizeof&#40;BITMAPINFOHEADER&#41;, 1, fp_rgb&#41;;
					
					convertRGBBuffer&#40;RGBBuffer0, RGBBuffer1, bmp_width, bmp_height&#41;;
					
					fwrite&#40;RGBBuffer1, 4*bmp_width*bmp_height, 1, fp_rgb&#41;;
					fclose&#40;fp_rgb&#41;;
				&#125;
			&#125;			
		&#125;
		
		++frame_count;
		if &#40; frame_count >= 5 &#41; 
			break;
	&#125;
	
	
wait&#58;
	mp4_read_close&#40;&reader&#41;;
		
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"press triangle to exit...\n"&#41;;
	sceCtrlReadBufferPositive&#40;&input, 1&#41;;
	while&#40;!&#40;input.Buttons & PSP_CTRL_TRIANGLE&#41;&#41;
	&#123;
		sceKernelDelayThread&#40;10000&#41;;	// wait 10 milliseconds
		sceCtrlReadBufferPositive&#40;&input, 1&#41;;
	&#125;
	
	sceKernelExitGame&#40;&#41;;
	return 0;
&#125;


/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41;
&#123;
	sceKernelExitGame&#40;&#41;;
	return 0;
&#125;


/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41;
&#123;
	int cbid;

	cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
	sceKernelRegisterExitCallback&#40;cbid&#41;;

	sceKernelSleepThreadCB&#40;&#41;;

	return 0;
&#125;


/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41;
&#123;
	int thid = 0;

	thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, 0, 0&#41;;
	if&#40;thid >= 0&#41;
	&#123;
		sceKernelStartThread&#40;thid, 0, 0&#41;;
	&#125;

	return thid;
&#125;

Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

Thanks for sharing and good work :D
Image
Upgrade your PSP
victorprosa
Posts: 37
Joined: Wed Jan 14, 2009 5:53 am

Post by victorprosa »

Thank you VERY VERY much cooleyes

EDIT:

Cooleyes, i had some bad blocks when compiled the original source:

Code: Select all

main.c&#58;156&#58; warning&#58; initialization from incompatible pointer type
main.c&#58;156&#58; warning&#58; initialization from incompatible pointer type
main.c&#58; In function ‘main’&#58;
main.c&#58;223&#58; warning&#58; implicit declaration of function ‘getcwd’
main.c&#58;239&#58; warning&#58; implicit declaration of function ‘sceUtilityLoadAvModule’
main.c&#58;282&#58; warning&#58; implicit declaration of function ‘cooleyesMeBootStart’
main.c&#58;323&#58; warning&#58; passing argument 7 of ‘sceMpegCreate’ makes integer from pointer without a cast
main.c&#58;385&#58; warning&#58; implicit declaration of function ‘sceMpegGetAvcNalAu’
main.c&#58;391&#58; warning&#58; implicit declaration of function ‘sceMpegAvcDecodeDetail2’
main.c&#58;414&#58; warning&#58; implicit declaration of function ‘sceMpegBaseCscAvc’
main.c&#58;340&#58; warning&#58; unused variable ‘nal_buffer’

Code: Select all

mp4_read.c&#58; In function ‘audio_swap_asynchronous_buffers’&#58;
mp4_read.c&#58;198&#58; warning&#58; initialization from incompatible pointer type
mp4_read.c&#58;200&#58; warning&#58; assignment from incompatible pointer type
Anyway to solve this, or just don't matter with it?, as soon, as everything (eboot, param and PRX) was created...
Shapyi
Posts: 95
Joined: Mon Apr 25, 2005 9:31 am

Post by Shapyi »

Great work, thanks for sharing. Does this just work with AVC or does it work with both MPEG4-ASP and H.264? Have you discovered a similar method for decoding standard MPEG4 with resolutions above 480x272? Because I remember seeing this thread awhile back, it would be great to decode XviD using the PSP's built in hardware if possible.
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

victorprosa wrote:Thank you VERY VERY much cooleyes

EDIT:

Cooleyes, i had some bad blocks when compiled the original source:

Code: Select all

main.c&#58;156&#58; warning&#58; initialization from incompatible pointer type
main.c&#58;156&#58; warning&#58; initialization from incompatible pointer type
main.c&#58; In function ‘main’&#58;
main.c&#58;223&#58; warning&#58; implicit declaration of function ‘getcwd’
main.c&#58;239&#58; warning&#58; implicit declaration of function ‘sceUtilityLoadAvModule’
main.c&#58;282&#58; warning&#58; implicit declaration of function ‘cooleyesMeBootStart’
main.c&#58;323&#58; warning&#58; passing argument 7 of ‘sceMpegCreate’ makes integer from pointer without a cast
main.c&#58;385&#58; warning&#58; implicit declaration of function ‘sceMpegGetAvcNalAu’
main.c&#58;391&#58; warning&#58; implicit declaration of function ‘sceMpegAvcDecodeDetail2’
main.c&#58;414&#58; warning&#58; implicit declaration of function ‘sceMpegBaseCscAvc’
main.c&#58;340&#58; warning&#58; unused variable ‘nal_buffer’

Code: Select all

mp4_read.c&#58; In function ‘audio_swap_asynchronous_buffers’&#58;
mp4_read.c&#58;198&#58; warning&#58; initialization from incompatible pointer type
mp4_read.c&#58;200&#58; warning&#58; assignment from incompatible pointer type
Anyway to solve this, or just don't matter with it?, as soon, as everything (eboot, param and PRX) was created...
it just warning, don't matter with it.
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

Shapyi wrote:Great work, thanks for sharing. Does this just work with AVC or does it work with both MPEG4-ASP and H.264? Have you discovered a similar method for decoding standard MPEG4 with resolutions above 480x272? Because I remember seeing this thread awhile back, it would be great to decode XviD using the PSP's built in hardware if possible.
I will try, but I can't promise it.
ctszy
Posts: 18
Joined: Sat Apr 12, 2008 11:18 pm

Post by ctszy »

THX 4 sharing, Great Work :)
slasher2661996
Posts: 91
Joined: Sun Feb 22, 2009 8:32 am
Location: Melbourne Australia ZOMG

Post by slasher2661996 »

WARNINGS DO! MATTER!!![/i][/b]
NoEffex
Posts: 106
Joined: Thu Nov 27, 2008 6:48 am

Post by NoEffex »

slasher2661996 wrote:WARNINGS DO! MATTER!!![/i][/b]
Sometimes. Other times they are indeed just warnings and are more of an annoyance than anything.

Anyways, very nice, and thank you for sharing this..complex piece of code, and licensing it under the GPL :D.
Programming with:
Geany + Latest PSPSDK from svn
Post Reply