Hello , i'm using the cisco OpenH264 codec in coding and decoding process , the coding stage works very well and i can read my encoded H.264 file correctly , the issue is with my decoding process and mainly the conversion from I420 to ARGB , please can any one helps to fix this .
Here's my Decoding function ( from the OpenH264 wrapper DLL ) :
and here's my Delphi implementation :Code:/* * [ IN ] SourceData : the encoded frame(s) * [ OUT ] pTargetbuffer : the Target buffer * [ OUT ] width * [ OUT ] height */ int H264Decoder_decode(BufferedData &SourceData, void *pTargetbuffer, int *width, int *height) { int iStride[2]; init(); ... the decoding routine : pData contains the YUV if (ret != dsErrorFree) { return -1; } if (!m_sBufferInfo.iBufferStatus) { return -2; } LWidth = m_sBufferInfo.UsrData.sSystemBuffer.iWidth; LHeight = m_sBufferInfo.UsrData.sSystemBuffer.iHeight; *width = LWidth; *height = LHeight; iStride[0] = m_sBufferInfo.UsrData.sSystemBuffer.iStride[0]; iStride[1] = m_sBufferInfo.UsrData.sSystemBuffer.iStride[1]; /* BOOL I420ToARGB(const unsigned char *src_y, int src_stride_y, const unsigned char *src_u, int src_stride_u, const unsigned char *src_v, int src_stride_v, unsigned char *dst_frame, int dst_stride_frame, int width, int height); */ I420ToARGB( (unsigned char *)pData[0],iStride[0], (unsigned char *)pData[1],iStride[1], (unsigned char *)pData[2],iStride[1], (unsigned char *)pTargetbuffer, /* * if i put LWidth*4 which is the correct way to get the real pixel i get an AV in delphi * and i think the AV is not related to delphi but the OpenH264 itself */ LWidth*2, LWidth,LHeight); return 0; }
Code:Image.Picture.Bitmap.PixelFormat := pf24bit; Image.Picture.Bitmap.Width := 320; Image.Picture.Bitmap.Height := 240; ... Result:=H264Decoder_decode(FEncodedBuffer, Image.Picture.Bitmap.ScanLine[Image.Picture.Bitmap.Height-1], EncodedBufferSize,LWidth,LHeight); if result=0 then Image.Repaint;
So many thanks .
yours,Randy
+ Reply to Thread
Results 1 to 5 of 5
-
Last edited by randydom; 1st Dec 2017 at 00:42.
-
If i understand correctly your problem then I420 use 12 bits per pixel (U and V are 1/4 size each of the Y plane size), ARGB use 32 bits per pixel. before converting YUV (or correctly YCbCr) you should upscale plane U and V to size of plane Y (this sampling scheme is called 4:4:4). A is Alpha plane and it doesn't exist in your YUV source so you need to create it as empty table filled with constant.
If i misunderstood your problem then sorry. -
-
so many thanks i've fixed it , the issue was that i used :
Code:Image.Picture.Bitmap.PixelFormat := pf24bit;
Code:PixelFormat is the pf32bit
-
Last edited by jagabo; 30th Nov 2017 at 17:14.
Similar Threads
-
Can we decode H264 in ffmpeg?
By nothingnew in forum Newbie / General discussionsReplies: 22Last Post: 18th Aug 2017, 03:47 -
Help to decode URL with technology AKAMAI
By Richardrocha in forum Video Streaming DownloadingReplies: 2Last Post: 23rd Jul 2016, 10:42 -
not able to decode streaming url
By joejax in forum Newbie / General discussionsReplies: 0Last Post: 7th Mar 2016, 07:31 -
CISCO OpenH264 Released
By Kyousuke in forum Latest Video NewsReplies: 0Last Post: 9th Dec 2013, 10:22 -
how decode stream with token???
By soso8782 in forum Video Streaming DownloadingReplies: 6Last Post: 25th Jun 2013, 14:04