Lines Matching refs:pJPEGContext

324 static void IssueQmatix(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext)  in IssueQmatix()  argument
327 context_ENC_p ctx = (context_ENC_p)pJPEGContext->ctx; in IssueQmatix()
330 ASSERT(NULL != pJPEGContext->pMemInfoTableBlock); in IssueQmatix()
359 static void InitializeJpegEncode(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext) in InitializeJpegEncode() argument
361 context_ENC_p ctx = (context_ENC_p)pJPEGContext->ctx; in InitializeJpegEncode()
374 switch (pJPEGContext->eFormat) { in InitializeJpegEncode()
377 pJPEGContext->MCUComponent[0].ui32WidthBlocks = 16; in InitializeJpegEncode()
378 pJPEGContext->MCUComponent[0].ui32HeightBlocks = 16; in InitializeJpegEncode()
379 pJPEGContext->MCUComponent[0].ui32XLimit = ui16_width; in InitializeJpegEncode()
380 pJPEGContext->MCUComponent[0].ui32YLimit = ui16_height; in InitializeJpegEncode()
382 pJPEGContext->MCUComponent[1].ui32WidthBlocks = 8; in InitializeJpegEncode()
383 pJPEGContext->MCUComponent[1].ui32HeightBlocks = 8; in InitializeJpegEncode()
384 pJPEGContext->MCUComponent[1].ui32XLimit = ui16_width >> 1; in InitializeJpegEncode()
385 pJPEGContext->MCUComponent[1].ui32YLimit = ui16_height >> 1; in InitializeJpegEncode()
387 pJPEGContext->MCUComponent[2].ui32WidthBlocks = 8; in InitializeJpegEncode()
388 pJPEGContext->MCUComponent[2].ui32HeightBlocks = 8; in InitializeJpegEncode()
389 pJPEGContext->MCUComponent[2].ui32XLimit = ui16_width >> 1; in InitializeJpegEncode()
390 pJPEGContext->MCUComponent[2].ui32YLimit = ui16_height >> 1; in InitializeJpegEncode()
395 switch (ISCHROMAINTERLEAVED(pJPEGContext->eFormat)) { in InitializeJpegEncode()
400 pJPEGContext->MCUComponent[1].ui32WidthBlocks += in InitializeJpegEncode()
401 pJPEGContext->MCUComponent[2].ui32WidthBlocks; in InitializeJpegEncode()
402 pJPEGContext->MCUComponent[1].ui32XLimit += in InitializeJpegEncode()
403 pJPEGContext->MCUComponent[2].ui32XLimit; in InitializeJpegEncode()
404 pJPEGContext->MCUComponent[2].ui32XLimit = in InitializeJpegEncode()
405 pJPEGContext->MCUComponent[2].ui32YLimit = in InitializeJpegEncode()
406 pJPEGContext->MCUComponent[2].ui32WidthBlocks = in InitializeJpegEncode()
407 pJPEGContext->MCUComponent[2].ui32HeightBlocks = 0; in InitializeJpegEncode()
411 pJPEGContext->sScan_Encode_Info.ui32NumberMCUsX = in InitializeJpegEncode()
412 (pJPEGContext->MCUComponent[0].ui32XLimit + in InitializeJpegEncode()
413 (pJPEGContext->MCUComponent[0].ui32WidthBlocks - 1)) / in InitializeJpegEncode()
414 pJPEGContext->MCUComponent[0].ui32WidthBlocks; in InitializeJpegEncode()
415 pJPEGContext->sScan_Encode_Info.ui32NumberMCUsY = in InitializeJpegEncode()
416 (pJPEGContext->MCUComponent[0].ui32YLimit + in InitializeJpegEncode()
417 (pJPEGContext->MCUComponent[0].ui32HeightBlocks - 1)) / in InitializeJpegEncode()
418 pJPEGContext->MCUComponent[0].ui32HeightBlocks; in InitializeJpegEncode()
419 pJPEGContext->sScan_Encode_Info.ui32NumberMCUsToEncode = in InitializeJpegEncode()
420 pJPEGContext->sScan_Encode_Info.ui32NumberMCUsX * in InitializeJpegEncode()
421 pJPEGContext->sScan_Encode_Info.ui32NumberMCUsY; in InitializeJpegEncode()
423 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "Number of X MCUs: %d\n", pJPEGContext->sScan_Encode_Info.ui32N… in InitializeJpegEncode()
424 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "Number of Y MCUs: %d\n", pJPEGContext->sScan_Encode_Info.ui32N… in InitializeJpegEncode()
425 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "Number of total MCUs: %d\n", pJPEGContext->sScan_Encode_Info.u… in InitializeJpegEncode()
430 pJPEGContext->sScan_Encode_Info.ui32NumberMCUsToEncodePerScan = in InitializeJpegEncode()
431 …(pJPEGContext->sScan_Encode_Info.ui32NumberMCUsY + (pJPEGContext->NumCores - 1)) / pJPEGContext->N… in InitializeJpegEncode()
432 pJPEGContext->sScan_Encode_Info.ui32NumberMCUsToEncodePerScan *= in InitializeJpegEncode()
433 pJPEGContext->sScan_Encode_Info.ui32NumberMCUsX; in InitializeJpegEncode()
435 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "Number of MCUs per core: %d\n", pJPEGContext->sScan_Encode_Inf… in InitializeJpegEncode()
442 ui32UpperLimit = PTG_JPEG_MAX_MCU_PER_SCAN / pJPEGContext->sScan_Encode_Info.ui32NumberMCUsX; in InitializeJpegEncode()
443 ui32UpperLimit *= pJPEGContext->sScan_Encode_Info.ui32NumberMCUsX; in InitializeJpegEncode()
445 if (pJPEGContext->sScan_Encode_Info.ui32NumberMCUsToEncodePerScan > ui32UpperLimit) { in InitializeJpegEncode()
447 pJPEGContext->sScan_Encode_Info.ui32NumberMCUsToEncodePerScan = ui32UpperLimit; in InitializeJpegEncode()
450 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "Number of MCUs per scan: %d\n", pJPEGContext->sScan_Encode_Inf… in InitializeJpegEncode()
454 pJPEGContext->sScan_Encode_Info.ui16ScansInImage = in InitializeJpegEncode()
455 (pJPEGContext->sScan_Encode_Info.ui32NumberMCUsToEncode + in InitializeJpegEncode()
456 (pJPEGContext->sScan_Encode_Info.ui32NumberMCUsToEncodePerScan - 1)) / in InitializeJpegEncode()
457 pJPEGContext->sScan_Encode_Info.ui32NumberMCUsToEncodePerScan; in InitializeJpegEncode()
459 pJPEGContext->sScan_Encode_Info.ui8NumberOfCodedBuffers = in InitializeJpegEncode()
460 pJPEGContext->sScan_Encode_Info.ui16ScansInImage; in InitializeJpegEncode()
462 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "Scans in image: %d\n", pJPEGContext->sScan_Encode_Info.ui16Sca… in InitializeJpegEncode()
463 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "Number of coded buffers: %d\n", pJPEGContext->sScan_Encode_Inf… in InitializeJpegEncode()
468 static void AssignCodedDataBuffers(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext) in AssignCodedDataBuffers() argument
471 pJPEGContext->ui32SizePerCodedBuffer = in AssignCodedDataBuffers()
472 (pJPEGContext->jpeg_coded_buf.ui32Size - PTG_JPEG_HEADER_MAX_SIZE) / in AssignCodedDataBuffers()
473 pJPEGContext->sScan_Encode_Info.ui8NumberOfCodedBuffers; in AssignCodedDataBuffers()
474 pJPEGContext->ui32SizePerCodedBuffer &= ~0xf; in AssignCodedDataBuffers()
476 memset((void *)pJPEGContext->sScan_Encode_Info.aBufferTable, 0x0, in AssignCodedDataBuffers()
477 … sizeof(TOPAZHP_JPEG_BUFFER_INFO)*pJPEGContext->sScan_Encode_Info.ui8NumberOfCodedBuffers); in AssignCodedDataBuffers()
479 …IDEO_DEBUG_GENERAL, "jpeg_coded_buf.pMemInfo: 0x%x\n", (unsigned int)(pJPEGContext->jpeg_coded_buf… in AssignCodedDataBuffers()
481 … for (ui8Loop = 0 ; ui8Loop < pJPEGContext->sScan_Encode_Info.ui8NumberOfCodedBuffers; ui8Loop++) { in AssignCodedDataBuffers()
484 pJPEGContext->sScan_Encode_Info.aBufferTable[ui8Loop].ui32DataBufferUsedBytes = 0; in AssignCodedDataBuffers()
485pJPEGContext->sScan_Encode_Info.aBufferTable[ui8Loop].i8PipeNumber = 0; // Indicates buffer is idle in AssignCodedDataBuffers()
486pJPEGContext->sScan_Encode_Info.aBufferTable[ui8Loop].ui16ScanNumber = 0; // Indicates buffer is i… in AssignCodedDataBuffers()
488 pJPEGContext->sScan_Encode_Info.aBufferTable[ui8Loop].pMemInfo = (void *) in AssignCodedDataBuffers()
489 ((IMG_UINT32)pJPEGContext->jpeg_coded_buf.pMemInfo + PTG_JPEG_HEADER_MAX_SIZE + in AssignCodedDataBuffers()
490 ui8Loop * pJPEGContext->ui32SizePerCodedBuffer); in AssignCodedDataBuffers()
492 … (unsigned int)(pJPEGContext->sScan_Encode_Info.aBufferTable[ui8Loop].pMemInfo)); in AssignCodedDataBuffers()
498 static void SetSetupInterface(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext) in SetSetupInterface() argument
500 context_ENC_p ctx = (context_ENC_p)pJPEGContext->ctx; in SetSetupInterface()
504 tng_cmdbuf_set_phys(pJPEGContext->pMTXWritebackMemory->apWritebackRegions, WB_FIFO_SIZE, in SetSetupInterface()
508 static void IssueSetupInterface(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext) in IssueSetupInterface() argument
511 context_ENC_p ctx = (context_ENC_p)pJPEGContext->ctx; in IssueSetupInterface()
513 ASSERT(NULL != pJPEGContext->pMTXSetup); in IssueSetupInterface()
518 pJPEGContext->pMTXWritebackMemory->apWritebackRegions[i]); in IssueSetupInterface()
530 TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext, in SetMTXSetup() argument
534 context_ENC_p ctx = (context_ENC_p)pJPEGContext->ctx; in SetMTXSetup()
539 pJPEGContext->pMTXSetup->ui32ComponentsInScan = MTX_MAX_COMPONENTS; in SetMTXSetup()
541 switch (pJPEGContext->eFormat) { in SetMTXSetup()
548 pJPEGContext->pMTXSetup->ComponentPlane[0].ui32Stride = pTFrame->psb_surface->stride; in SetMTXSetup()
549 pJPEGContext->pMTXSetup->ComponentPlane[1].ui32Stride = pTFrame->psb_surface->stride; in SetMTXSetup()
550 pJPEGContext->pMTXSetup->ComponentPlane[2].ui32Stride = pTFrame->psb_surface->stride; in SetMTXSetup()
552pJPEGContext->pMTXSetup->ComponentPlane[0].ui32Height = pJPEGContext->MCUComponent[0].ui32YLimit; in SetMTXSetup()
553pJPEGContext->pMTXSetup->ComponentPlane[1].ui32Height = pJPEGContext->MCUComponent[0].ui32YLimit /… in SetMTXSetup()
554pJPEGContext->pMTXSetup->ComponentPlane[2].ui32Height = pJPEGContext->MCUComponent[0].ui32YLimit /… in SetMTXSetup()
557 drv_debug_msg(VIDEO_DEBUG_ERROR, "Not supported FOURCC: %x!\n", pJPEGContext->eFormat); in SetMTXSetup()
562 …RELOC_JPEG_PIC_PARAMS_PTG(&pJPEGContext->pMTXSetup->ComponentPlane[0].ui32PhysAddr, srf_buf_offset… in SetMTXSetup()
564 switch (pJPEGContext->eFormat) { in SetMTXSetup()
566 RELOC_JPEG_PIC_PARAMS_PTG(&pJPEGContext->pMTXSetup->ComponentPlane[1].ui32PhysAddr, in SetMTXSetup()
571 RELOC_JPEG_PIC_PARAMS_PTG(&pJPEGContext->pMTXSetup->ComponentPlane[2].ui32PhysAddr, in SetMTXSetup()
576 drv_debug_msg(VIDEO_DEBUG_ERROR, "Not supported FOURCC: %x!\n", pJPEGContext->eFormat); in SetMTXSetup()
580 memcpy((void *)pJPEGContext->pMTXSetup->MCUComponent, in SetMTXSetup()
581 (void *)pJPEGContext->MCUComponent, in SetMTXSetup()
582 sizeof(pJPEGContext->MCUComponent)); in SetMTXSetup()
584 pJPEGContext->pMTXSetup->ui32TableA = 0; in SetMTXSetup()
585 pJPEGContext->pMTXSetup->ui16DataInterleaveStatus = ISCHROMAINTERLEAVED(pJPEGContext->eFormat); in SetMTXSetup()
586 pJPEGContext->pMTXSetup->ui16MaxPipes = (IMG_UINT16)pJPEGContext->NumCores; in SetMTXSetup()
591 static void IssueMTXSetup(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext) in IssueMTXSetup() argument
594 context_ENC_p ctx = (context_ENC_p)pJPEGContext->ctx; in IssueMTXSetup()
597 ASSERT(NULL != pJPEGContext->pMTXSetup); in IssueMTXSetup()
600 for (i = 0; i < pJPEGContext->pMTXSetup->ui32ComponentsInScan; i++) { in IssueMTXSetup()
602 pJPEGContext->pMTXSetup->ComponentPlane[i].ui32PhysAddr, in IssueMTXSetup()
603 pJPEGContext->pMTXSetup->ComponentPlane[i].ui32Stride, in IssueMTXSetup()
604 pJPEGContext->pMTXSetup->ComponentPlane[i].ui32Height); in IssueMTXSetup()
606 pJPEGContext->pMTXSetup->MCUComponent[i].ui32WidthBlocks, in IssueMTXSetup()
607 pJPEGContext->pMTXSetup->MCUComponent[i].ui32HeightBlocks, in IssueMTXSetup()
608 pJPEGContext->pMTXSetup->MCUComponent[i].ui32XLimit, in IssueMTXSetup()
609 pJPEGContext->pMTXSetup->MCUComponent[i].ui32YLimit); in IssueMTXSetup()
612 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "ui32ComponentsInScan: %d\n", pJPEGContext->pMTXSetup->ui32Comp… in IssueMTXSetup()
613 drv_debug_msg(VIDEO_DEBUG_GENERAL, "ui32TableA: %d\n", pJPEGContext->pMTXSetup->ui32TableA); in IssueMTXSetup()
614 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "ui16DataInterleaveStatus: %d\n", pJPEGContext->pMTXSetup->ui16… in IssueMTXSetup()
615 drv_debug_msg(VIDEO_DEBUG_GENERAL, "ui16MaxPipes: %d\n", pJPEGContext->pMTXSetup->ui16MaxPipes); in IssueMTXSetup()
643 static IMG_UINT32 EncodeMarkerSegment(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext, in EncodeMarkerSegment() argument
663 … fPutBitsToBuffer(&s_streamW, 1, pJPEGContext->psTablesBlock->aui8LumaQuantParams[gZigZag[uc_i]]); in EncodeMarkerSegment()
673 …fPutBitsToBuffer(&s_streamW, 1, pJPEGContext->psTablesBlock->aui8ChromaQuantParams[gZigZag[uc_i]]); in EncodeMarkerSegment()
710 if (pJPEGContext->sScan_Encode_Info.ui16CScan > 1) { in EncodeMarkerSegment()
714 …fPutBitsToBuffer(&s_streamW, 2, pJPEGContext->sScan_Encode_Info.ui32NumberMCUsToEncodePerScan); //… in EncodeMarkerSegment()
720 static IMG_UINT32 EncodeFrameHeader(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext, in EncodeFrameHeader() argument
726 uc_num_comp_in_img = pJPEGContext->pMTXSetup->ui32ComponentsInScan; in EncodeFrameHeader()
742 fPutBitsToBuffer(&ps_streamW, 2, pJPEGContext->ui32OutputHeight); in EncodeFrameHeader()
744 fPutBitsToBuffer(&ps_streamW, 2, pJPEGContext->ui32OutputWidth); in EncodeFrameHeader()
750 if (pJPEGContext->pMTXSetup->ui16DataInterleaveStatus < C_INTERLEAVE) { in EncodeFrameHeader()
754 …PutBitsToBuffer(&ps_streamW, 1, ((pJPEGContext->pMTXSetup->MCUComponent[0].ui32WidthBlocks >> 3) <… in EncodeFrameHeader()
760 …PutBitsToBuffer(&ps_streamW, 1, ((pJPEGContext->pMTXSetup->MCUComponent[1].ui32WidthBlocks >> 3) <… in EncodeFrameHeader()
764 …PutBitsToBuffer(&ps_streamW, 1, ((pJPEGContext->pMTXSetup->MCUComponent[2].ui32WidthBlocks >> 3) <… in EncodeFrameHeader()
766 } else if (pJPEGContext->pMTXSetup->ui16DataInterleaveStatus == C_INTERLEAVE) { in EncodeFrameHeader()
770 …PutBitsToBuffer(&ps_streamW, 1, ((pJPEGContext->pMTXSetup->MCUComponent[0].ui32WidthBlocks >> 3) <… in EncodeFrameHeader()
776 …PutBitsToBuffer(&ps_streamW, 1, ((pJPEGContext->pMTXSetup->MCUComponent[1].ui32WidthBlocks >> 4) <… in EncodeFrameHeader()
781 …PutBitsToBuffer(&ps_streamW, 1, ((pJPEGContext->pMTXSetup->MCUComponent[1].ui32WidthBlocks >> 4) <… in EncodeFrameHeader()
787 …PutBitsToBuffer(&ps_streamW, 1, ((pJPEGContext->pMTXSetup->MCUComponent[0].ui32WidthBlocks >> 4) <… in EncodeFrameHeader()
793 …PutBitsToBuffer(&ps_streamW, 1, ((pJPEGContext->pMTXSetup->MCUComponent[0].ui32WidthBlocks >> 5) <… in EncodeFrameHeader()
797 …PutBitsToBuffer(&ps_streamW, 1, ((pJPEGContext->pMTXSetup->MCUComponent[0].ui32WidthBlocks >> 5) <… in EncodeFrameHeader()
808 static IMG_UINT32 JPGEncodeMarker(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext , in JPGEncodeMarker() argument
817 …*pui32BytesWritten += EncodeMarkerSegment(pJPEGContext, pui8BitStreamBuffer + *pui32BytesWritten, … in JPGEncodeMarker()
822 static IMG_UINT32 JPGEncodeHeader(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext, in JPGEncodeHeader() argument
830 *pui32BytesWritten += EncodeFrameHeader(pJPEGContext, pui8BitStreamBuffer + *pui32BytesWritten); in JPGEncodeHeader()
835 static IMG_UINT32 JPGEncodeSOSHeader(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext, in JPGEncodeSOSHeader() argument
848 fPutBitsToBuffer(&s_streamW, 2, 6 + (pJPEGContext->pMTXSetup->ui32ComponentsInScan << 1)); in JPGEncodeSOSHeader()
850 fPutBitsToBuffer(&s_streamW, 1, pJPEGContext->pMTXSetup->ui32ComponentsInScan); in JPGEncodeSOSHeader()
851 for (ui8Comp = 0; ui8Comp < pJPEGContext->pMTXSetup->ui32ComponentsInScan; ui8Comp++) { in JPGEncodeSOSHeader()
875 static void InitializeScanCounter(TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext) in InitializeScanCounter() argument
877 pJPEGContext->sScan_Encode_Info.ui16SScan = in InitializeScanCounter()
878 pJPEGContext->sScan_Encode_Info.ui16CScan = in InitializeScanCounter()
879 pJPEGContext->sScan_Encode_Info.ui16ScansInImage; in InitializeScanCounter()
882 static IMG_ERRORCODE PrepareHeader(TOPAZHP_JPEG_ENCODER_CONTEXT * pJPEGContext, IMG_CODED_BUFFER *p… in PrepareHeader() argument
896 …rc = JPGEncodeMarker(pJPEGContext, (IMG_UINT8 *) ui8OutputBuffer, &pCBuffer->ui32BytesWritten, bI… in PrepareHeader()
900 … rc = JPGEncodeHeader(pJPEGContext , (IMG_UINT8 *) ui8OutputBuffer , &pCBuffer->ui32BytesWritten); in PrepareHeader()
904 … rc = JPGEncodeSOSHeader(pJPEGContext, (IMG_UINT8 *) ui8OutputBuffer, &pCBuffer->ui32BytesWritten); in PrepareHeader()
912 TOPAZHP_JPEG_ENCODER_CONTEXT *pJPEGContext, in IssueBufferToHW() argument
918 context_ENC_p ctx = (context_ENC_p)(pJPEGContext->ctx); in IssueBufferToHW()
921pJPEGContext->sScan_Encode_Info.aBufferTable[ui16BCnt].ui32DataBufferUsedBytes = ((BUFFER_HEADER*)… in IssueBufferToHW()
924 pJPEGContext->sScan_Encode_Info.aBufferTable[ui16BCnt].ui16ScanNumber, in IssueBufferToHW()
929 …psBufferCmd = (MTX_ISSUE_BUFFERS *)(pJPEGContext->sScan_Encode_Info.aBufferTable[ui16BCnt].pMemInf… in IssueBufferToHW()
932 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "ui16ScansInImage: %d\n", pJPEGContext->sScan_Encode_Info.ui16S… in IssueBufferToHW()
933 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "ui16ScanNumber: %d\n", pJPEGContext->sScan_Encode_Info.aBuffer… in IssueBufferToHW()
934 …drv_debug_msg(VIDEO_DEBUG_GENERAL, "ui32NumberMCUsToEncodePerScan: %d\n", pJPEGContext->sScan_Enco… in IssueBufferToHW()
939 (((pJPEGContext->sScan_Encode_Info.ui16ScansInImage - in IssueBufferToHW()
940 pJPEGContext->sScan_Encode_Info.aBufferTable[ui16BCnt].ui16ScanNumber) * in IssueBufferToHW()
941 pJPEGContext->sScan_Encode_Info.ui32NumberMCUsToEncodePerScan)<<2)&(~2); in IssueBufferToHW()
951 …d Data: 0x%x\n", (unsigned int)(PTG_JPEG_HEADER_MAX_SIZE + ui16BCnt * pJPEGContext->ui32SizePerCod… in IssueBufferToHW()
959 … PTG_JPEG_HEADER_MAX_SIZE + ui16BCnt * pJPEGContext->ui32SizePerCodedBuffer); in IssueBufferToHW()