gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > kouky: bmp2gbavideo

#45659 - kouky - Mon Jun 13, 2005 2:20 pm

hello !

I'm in the process of working on a video codec for gba.
Actually, it's more a slideshow compression method than a video codec.
The concept is to use tilemode backgrounds on bgmode 1.
videos frames are organised in couples.
Each couple of frames share the same palette and the same tiles array.

my first demo : http://www.pikilipita.com/gba/kouky_20frames.gba

I'm sure i can get better compression rates, but i'm facing a problems :
I can't make a couple of frames sharing a tile array with more than 38400 values.
Is there a trick to use a bigger array ?
I'm using visual ham, here the code i use to display my frames :
Code:
map_fragment_info_ptr bg_vido;

(...)

 ham_SetBgMode(1);
    // ham_DeInitBg(1);
      ham_LoadBGPal((void*)jingle01_Palette,256);
// Setup the tileset for our image
 ham_bg[0].ti = ham_InitTileSet((void*)jingle01_Tiles,
       SIZEOF_16BIT(jingle01_Tiles),1,1);
    // Setup the map for our image
ham_bg[0].mi = ham_InitMapEmptySet(3,0);
bg_vido = ham_InitMapFragment((void*)jingle01_Map,
       30,20,0,0,30,20,0);
ham_InsertMapFragment(bg_vido,0,0,0);   
// Display the background
 ham_InitBg(0,1,0,0);

Anyone could help me?

#45661 - strager - Mon Jun 13, 2005 2:47 pm

You need to store it in EWRAM. Example on how this is done:
int huge_array[123456] __attribute__((.section(".ewram")) = { ... };
int large_array[123456] __attribute__((.section(".sbss"));

Use the first if the data is initialized, and the second if it is not initalized. Unless I am wrong... tepples help me out! :-P

Edit: It seems that your "video codec" is flickering. Maybe this is because you are not waiting for a VBlank on write/clear. If you do not how to do this, do a search on the forums.

#45707 - kouky - Mon Jun 13, 2005 11:34 pm

thanks for the help, but the error was included in my own compression software.
My results are interessting, i'll post more infos about my (basic) video codec as soon as i'll build a more user friendly version !

#45711 - tepples - Tue Jun 14, 2005 12:16 am

strager wrote:
You need to store it in EWRAM. Example on how this is done:
int huge_array[123456] __attribute__((.section(".ewram")) = { ... };
int large_array[123456] __attribute__((.section(".sbss"));

Almost. With an int array in EWRAM, it's best to keep the size under 64000 or so, as EWRAM is only 65536 ints (256 KiB) in size.

Quote:
Use the first if the data is initialized, and the second if it is not initalized. Unless I am wrong... tepples help me out! :-P

You're right, but be warned that appended data methods such as GBFS work with section .sbss only if the GBFS file is in ROM.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#46037 - kouky - Sat Jun 18, 2005 4:28 pm

FIRST RELEASE !
Changes bmp files to C arrays for Ham

download :http://www.pikilipita.com/gba/kouky_bmp2gbavideo.rar

Limitations :
May need framework 1.1 to run (You can get it thruw windows update)
Only works if you use Ham lib.
All your frames must share the same 256 colors palette
(gif movie gear or debabelizer can do it for you)

User manual :
Load your pictures, choose the compression rate (recommended : 1 or 2)
Check the project name
COMPRESS ( be patient !)
to play the video on your homebrew, just insert:
#include "myvideo.vid.h"
and
play_myvideo();

full example :
Code:
#include <mygba.h>
#include "g3dhelico.vid.h"

int main()
{
ham_Init();
play_g3dhelico();
while(1) {}
return 0;
} // End of main()


I hope you'll enjoy it !