[Java 1.5] Customization to support multiple video resolution display

  •  Have you ever faced the challenge for a running system that you can bearly understand what it does, to receive the requirement to support additional display resolution?

    What we have been asked (in addtition to PAL video display functionality) was to support also NTSC display. As we know, PAL is usually displayed in half size of the full frame, that is 352x288.

    NTSC is supposed to work in 320x240 resolution. The challenge here was the fact that the encoding part from server side only streams at fixed 352x288, therefore you see the NTSC video with black paddings on the right and bottom side.

     We needed some customization on the client video player, which is also a proprietary product which we can bearly touch. The idea was to leave the current client side decoder do the job and when it comes to create an image from the generated pixel map, copy the pixel areas we needed to a new pixel map array which would only contain the arreas of the image representing the 320x240 size.

    In the following sample, we copy pixel parts from Pix_Map to Pix_Map_NTSC. Remember that the first array is a single dimensional array [352288 pixels] and the destination array is a [320240] 

             //NTSC custom
            int rows = 0;
            int[] Pix_Map_NTSC = new int[76800];
                System.arraycopy(Pix_Map, (rows351), Pix_Map_NTSC, rows320, 320);


    Right after that we need:

    memoryImageSource = new MemoryImageSource( 320, 240, directColorModel, Pix_Map_NTSC, 0, 320 );
    image = createImage( memoryImageSource );


    Then, you can feed the image object to any display component you have (e.g: a Canvas object).


    Would appreciate your comments.




  • Thread moved to "coding related help & questions". 

Log in to reply

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.