static void
gst_ducati_vc1dec_update_buffer_size (GstDucatiVidDec * self)
{
  gint w = self->width;
  gint h = self->height;

  /* calculate output buffer parameters: */
  self->padded_width = ALIGN2 (w + (2 * PADX), 7);
  self->padded_height = (ALIGN2 (h / 2, 4) * 2) + 2 * PADY;
  self->min_buffers = 8;
}
static void
gst_ducati_h264dec_update_buffer_size (GstDucatiVidDec * self)
{
  gint w = self->width;
  gint h = self->height;

  /* calculate output buffer parameters: */
  self->padded_width = ALIGN2 (w + (2 * PADX), 7);
  self->padded_height = h + 4 * PADY;
  self->min_buffers = MIN (16, 32768 / ((w / 16) * (h / 16))) + 3;
}
static void
gst_ducati_mpeg4dec_update_buffer_size (GstDucatiVidDec * self)
{
  gint w = self->width;
  gint h = self->height;

  /* calculate output buffer parameters: */
  self->padded_width = ALIGN2 (w + PADX, 7);
  self->padded_height = h + PADY;
  self->min_buffers = 8;
}
Exemple #4
0
int omxAutoResize(ILCLIENT_T *client, IMAGE *inImage, IMAGE *outImage, const int display, 
			const int rotation, const char noAspect){
	
	outImage->pData = NULL;
	
	uint32_t sWidth, sHeight;

	if(outImage->height > 0 && outImage->width > 0){
		
		if(noAspect){
			return omxResize(client, inImage, outImage);
		}
		
		sWidth = outImage->width;
		sHeight= outImage->height;
	}else{
		graphics_get_display_size(display, &sWidth, &sHeight);
	}

	if(rotation == 90 || rotation == 270){
		uint32_t rotHeight = sHeight;
		sHeight = sWidth;
		sWidth = rotHeight;
	}
	
	float dAspect = (float) sWidth / sHeight;
	float iAspect = (float) inImage->width / inImage->height;

	if(dAspect > iAspect){
		outImage->height = sHeight;
		outImage->width = ALIGN2((int) (sHeight * iAspect));
	}else{
		outImage->width = sWidth;
		outImage->height = ALIGN2((int) (sWidth / iAspect));
	}
	
	return omxResize(client, inImage, outImage);
}
static gboolean
gst_ducati_viddec_parse_caps (GstDucatiVidDec * self, GstStructure * s)
{
  const GValue *codec_data;
  gint w, h;

  if (gst_structure_get_int (s, "width", &w) &&
      gst_structure_get_int (s, "height", &h)) {

    h = ALIGN2 (h, 4);                 /* round up to MB */
    w = ALIGN2 (w, 4);                 /* round up to MB */

    /* if we've already created codec, but the resolution has changed, we
     * need to re-create the codec:
     */
    if (G_UNLIKELY (self->codec)) {
      if ((h != self->height) || (w != self->width)) {
        codec_delete (self);
      }
    }

    self->width  = w;
    self->height = h;

    codec_data = gst_structure_get_value (s, "codec_data");

    if (codec_data) {
      GstBuffer *buffer = gst_value_get_buffer (codec_data);
      GST_DEBUG_OBJECT (self, "codec_data: %" GST_PTR_FORMAT, buffer);
      self->codec_data = gst_buffer_ref (buffer);
    }

    return TRUE;
  }

  return FALSE;
}
Exemple #6
0
int main (int argc, char * const argv[]) 
{
   // Settings
   u32 uiStartAddress   = 0;
   u32 uiOffset         = 0;
   u32 uiSize           = 0xFFFFFFFF;

   g_bShowLdrLabels = true;
   g_bShowComments  = false;
   g_bGccCompatible = true;
      
   // Parse arguments
   bool bError = false;
   int  i      = 1;
   for (i = 1; i < argc; i++)
   {
      if ('-' == argv[i][0])
      {
         switch (argv[i][1])
         {
         case 'a':
            // Stating address
            i++;
            if (argc == i)
               bError = true;
            else
               bError = !parse_number(argv[i],  uiStartAddress);
         	break;
         case 'o':
            // Start offset
            i++;
            if (argc == i)
               bError = true;
            else
               bError = !parse_number(argv[i],  uiOffset);
            break;
         case 's':
            // Disassemble size
            i++;
            if (argc == i)
               bError = true;
            else
               bError = !parse_number(argv[i],  uiSize);
            break;
         case 'p':
            g_bShowLdrLabels = false;
            break;
         default:
            bError = true;
            break;
         }
         
      }
      else
         break;
   }

   if (1 >= argc || bError || i != (argc - 1))
   {
      usage();
      return 0;
   }

   // Align
   uiStartAddress = ALIGN2(uiStartAddress);
   uiOffset       = ALIGN2(uiOffset);

   uiStartAddress += uiOffset;

   // Open file and start disassembly
   FILE *in = fopen(argv[i], "rb");
   if (in == NULL)
   {
      printf("mdisasm: Failed to open input file.\n");
      return 0;
   }

   // Seek to offset
   if (0 != fseek(in, uiOffset, SEEK_SET))
   {
      // Offset too biga nd is behind the file end, quit silently
      fclose(in);
      return 0;
   }

   // Prepare
   StartInstructionChain();

   // Disassemble
   u16   usCode;
   u16   usCode2;
   bool  bSkipFirstRead = false;

   for (u32 pos = 0; pos < uiSize;)
   {
      // Load 2 bytes from the file
      if (!bSkipFirstRead && 2 != fread(&usCode, 1, 2, in))
      {
         // End of the file, exit
         fclose(in);
         return 0;
      }
      bSkipFirstRead = false;

      // Try to load 2 more bytes
      if (2 != fread(&usCode2, 1, 2, in))
      {
         // End of file, try to decode as 16bit and exit
         DecodeInstruction(uiStartAddress + pos * 2, usCode, 0);
         fclose(in);
         return 0;
      }

      // Decode
      int iSize = DecodeInstruction(uiStartAddress + pos * 2, usCode, usCode2);
      if (1 == iSize)
      {
         // This is 16bit instruction, shft halfwords and continue
         usCode         = usCode2;
         bSkipFirstRead = true;
      }
      
      pos += iSize;
   }

   fclose(in);
   
   return 0;
}