opalvoip-svn Mailing List for OpalVOIP (Page 9)
Brought to you by:
csoutheren,
rjongbloed
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(71) |
Nov
(241) |
Dec
(143) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(210) |
Feb
(263) |
Mar
(214) |
Apr
(290) |
May
(203) |
Jun
(160) |
Jul
(128) |
Aug
(158) |
Sep
(376) |
Oct
(234) |
Nov
(227) |
Dec
(216) |
2009 |
Jan
(99) |
Feb
(151) |
Mar
(234) |
Apr
(143) |
May
(271) |
Jun
(244) |
Jul
(173) |
Aug
(124) |
Sep
(246) |
Oct
(178) |
Nov
(85) |
Dec
(77) |
2010 |
Jan
(101) |
Feb
(79) |
Mar
(92) |
Apr
(134) |
May
(125) |
Jun
(121) |
Jul
(61) |
Aug
(70) |
Sep
(86) |
Oct
(81) |
Nov
(65) |
Dec
(75) |
2011 |
Jan
(110) |
Feb
(119) |
Mar
(267) |
Apr
(154) |
May
(296) |
Jun
(177) |
Jul
(149) |
Aug
(124) |
Sep
(120) |
Oct
(116) |
Nov
(99) |
Dec
(121) |
2012 |
Jan
(78) |
Feb
(161) |
Mar
(323) |
Apr
(154) |
May
(190) |
Jun
(207) |
Jul
(176) |
Aug
(165) |
Sep
(137) |
Oct
(85) |
Nov
(112) |
Dec
(100) |
2013 |
Jan
(341) |
Feb
(102) |
Mar
(240) |
Apr
(216) |
May
(233) |
Jun
(226) |
Jul
(139) |
Aug
(192) |
Sep
(183) |
Oct
(211) |
Nov
(220) |
Dec
(110) |
2014 |
Jan
(203) |
Feb
(205) |
Mar
(100) |
Apr
(178) |
May
(194) |
Jun
(249) |
Jul
(136) |
Aug
(241) |
Sep
(226) |
Oct
(200) |
Nov
(94) |
Dec
(46) |
2015 |
Jan
(94) |
Feb
(74) |
Mar
(89) |
Apr
(78) |
May
(65) |
Jun
(70) |
Jul
(113) |
Aug
(176) |
Sep
(140) |
Oct
(154) |
Nov
(99) |
Dec
(115) |
2016 |
Jan
(102) |
Feb
(69) |
Mar
(97) |
Apr
(53) |
May
(42) |
Jun
(13) |
Jul
(42) |
Aug
(30) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <rjo...@us...> - 2016-03-28 15:45:51
|
Revision: 34726 http://sourceforge.net/p/opalvoip/code/34726 Author: rjongbloed Date: 2016-03-28 15:45:49 +0000 (Mon, 28 Mar 2016) Log Message: ----------- Small change to assure SIP INVITE has registered username in Contact field in some pathological conditions. Modified Paths: -------------- opal/branches/v3_16/src/sip/sipep.cxx Modified: opal/branches/v3_16/src/sip/sipep.cxx =================================================================== --- opal/branches/v3_16/src/sip/sipep.cxx 2016-03-28 15:20:12 UTC (rev 34725) +++ opal/branches/v3_16/src/sip/sipep.cxx 2016-03-28 15:45:49 UTC (rev 34726) @@ -2184,6 +2184,26 @@ PTRACE(4, "No registrar for aor sip:" << user << '@' << domain); } + if (isMethod && registrar != NULL) { + if (!mime.Has("Route")) { + if (!pdu.SetRoute(registrar->GetServiceRoute())) + pdu.SetRoute(registrar->GetProxy()); + } + + // For many servers the From address must be address-of-record, but don't touch if dialog already done + if (connection == NULL || !connection->GetDialog().IsEstablished()) { + PStringToString fieldParams = from.GetFieldParameters(); + from = registrar->GetAddressOfRecord(); + from.GetFieldParameters() = fieldParams; + if (connection != NULL) + from.SetDisplayName(connection->GetDisplayName()); + from.Sanitise(SIPURL::FromURI); + mime.SetFrom(from); + PTRACE(4, "Adjusted 'From' to " << from << " from registered user."); + user = from.GetUserName(); + } + } + if (!mime.Has("Contact") && pdu.GetStatusCode() != SIP_PDU::Information_Trying) { OpalTransportAddress remoteAddress = pdu.GetURI().GetTransportAddress(); SIPURL contact; @@ -2224,25 +2244,6 @@ contact.Sanitise(SIPURL::ContactURI); mime.SetContact(contact.AsQuotedString()); } - - if (isMethod && registrar != NULL) { - if (!mime.Has("Route")) { - if (!pdu.SetRoute(registrar->GetServiceRoute())) - pdu.SetRoute(registrar->GetProxy()); - } - - // For many servers the From address must be address-of-record, but don't touch if dialog already done - if (connection == NULL || !connection->GetDialog().IsEstablished()) { - PStringToString fieldParams = from.GetFieldParameters(); - from = registrar->GetAddressOfRecord(); - from.GetFieldParameters() = fieldParams; - if (connection != NULL) - from.SetDisplayName(connection->GetDisplayName()); - from.Sanitise(SIPURL::FromURI); - mime.SetFrom(from); - PTRACE(4, "Adjusted 'From' to " << from << " from registered user."); - } - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-28 15:20:15
|
Revision: 34725 http://sourceforge.net/p/opalvoip/code/34725 Author: rjongbloed Date: 2016-03-28 15:20:12 +0000 (Mon, 28 Mar 2016) Log Message: ----------- Tried to make sure RRFC 2833 codec (aka "telephone-event") uses payload type 101. Extra debugging added to figure out why it is not doing so, if attempted fix does not work. Modified Paths: -------------- opal/branches/v3_16/src/codec/opalpluginmgr.cxx opal/branches/v3_16/src/opal/mediafmt.cxx Modified: opal/branches/v3_16/src/codec/opalpluginmgr.cxx =================================================================== --- opal/branches/v3_16/src/codec/opalpluginmgr.cxx 2016-03-28 14:56:18 UTC (rev 34724) +++ opal/branches/v3_16/src/codec/opalpluginmgr.cxx 2016-03-28 15:20:12 UTC (rev 34725) @@ -1741,6 +1741,9 @@ GetOpalYUV420P(); #endif + // Make sure "telephone-event" payload type allocated + GetOpalRFC2833(); + for (unsigned i = 0; i < count; i++,codecDefn++) { #if PTRACING OpalPluginControl setLogFn(codecDefn, PLUGINCODEC_CONTROL_SET_LOG_FUNCTION); Modified: opal/branches/v3_16/src/opal/mediafmt.cxx =================================================================== --- opal/branches/v3_16/src/opal/mediafmt.cxx 2016-03-28 14:56:18 UTC (rev 34724) +++ opal/branches/v3_16/src/opal/mediafmt.cxx 2016-03-28 15:20:12 UTC (rev 34725) @@ -1303,10 +1303,14 @@ // If we had a conflict we change the older one, as it is assumed that the // application really wanted that value and internal OPAL ones can move - if (conflictingFormat != NULL) + if (conflictingFormat == NULL) + rtpPayloadType = (RTP_DataFrame::PayloadTypes)nextUnused; + else { + PTRACE(3, "Conflicting payload type: " + << *conflictingFormat << " moved to " << nextUnused + << " as " << fullName << " requires " << rtpPayloadType); conflictingFormat->SetPayloadType((RTP_DataFrame::PayloadTypes)nextUnused); - else - rtpPayloadType = (RTP_DataFrame::PayloadTypes)nextUnused; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-28 14:56:21
|
Revision: 34724 http://sourceforge.net/p/opalvoip/code/34724 Author: rjongbloed Date: 2016-03-28 14:56:18 +0000 (Mon, 28 Mar 2016) Log Message: ----------- Plugged race condition where after receiving a BYE and sending 200, we try and send another BYE. THis is mostly cosmetic, and it should be noted this behaviour can still happen, as there is an "over the wire" race condition which the protocol is designed to deal with. Modified Paths: -------------- opal/branches/v3_16/src/sip/sipcon.cxx Modified: opal/branches/v3_16/src/sip/sipcon.cxx =================================================================== --- opal/branches/v3_16/src/sip/sipcon.cxx 2016-03-28 14:36:44 UTC (rev 34723) +++ opal/branches/v3_16/src/sip/sipcon.cxx 2016-03-28 14:56:18 UTC (rev 34724) @@ -2674,12 +2674,13 @@ SIPTransaction * response = new SIPResponse(GetEndPoint(), request, SIP_PDU::Successful_OK); response->Send(); + + releaseMethod = ReleaseWithNothing; if (IsReleased()) { PTRACE(2, "Already released " << *this); return; } - releaseMethod = ReleaseWithNothing; m_dialog.Update(request); UpdateRemoteAddresses(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-28 14:36:46
|
Revision: 34723 http://sourceforge.net/p/opalvoip/code/34723 Author: rjongbloed Date: 2016-03-28 14:36:44 +0000 (Mon, 28 Mar 2016) Log Message: ----------- Added "Refer-To" data to OnTransfterNotify() call back, so application does not have to keep track of who the transfer is being made to. Modified Paths: -------------- opal/branches/v3_16/include/sip/sipcon.h opal/branches/v3_16/src/sip/sipcon.cxx Modified: opal/branches/v3_16/include/sip/sipcon.h =================================================================== --- opal/branches/v3_16/include/sip/sipcon.h 2016-03-24 17:47:03 UTC (rev 34722) +++ opal/branches/v3_16/include/sip/sipcon.h 2016-03-28 14:36:44 UTC (rev 34723) @@ -760,6 +760,7 @@ bool m_referOfRemoteInProgress; PoolTimer m_delayedReferTimer; SIPURL m_delayedReferTo; + SIPURL m_sentReferTo; PSafeList<SIPTransaction> m_forkedInvitations; // Not for re-INVITE PSafeList<SIPTransaction> m_pendingInvitations; // For re-INVITE Modified: opal/branches/v3_16/src/sip/sipcon.cxx =================================================================== --- opal/branches/v3_16/src/sip/sipcon.cxx 2016-03-24 17:47:03 UTC (rev 34722) +++ opal/branches/v3_16/src/sip/sipcon.cxx 2016-03-28 14:36:44 UTC (rev 34723) @@ -333,6 +333,7 @@ PStringToString info; info.SetAt("result", "blind"); info.SetAt("party", "B"); + info.SetAt("Refer-To", m_sentReferTo); OnTransferNotify(info, this); } @@ -496,10 +497,10 @@ // Check for valid RFC2396 scheme if (!PURL::ExtractScheme(remoteParty).IsEmpty()) { - SIPURL referTo(remoteParty); - referTo.Sanitise(SIPURL::RedirectURI); - PTRACE(3, "Blind transfer of " << *this << " to " << referTo << ", referSubMode=" << referSubMode); - SIPRefer * referTransaction = new SIPRefer(*this, referTo, m_dialog.GetLocalURI(), referSubMode); + m_sentReferTo = remoteParty; + m_sentReferTo.Sanitise(SIPURL::RedirectURI); + PTRACE(3, "Blind transfer of " << *this << " to " << m_sentReferTo << ", referSubMode=" << referSubMode); + SIPRefer * referTransaction = new SIPRefer(*this, m_sentReferTo, m_dialog.GetLocalURI(), referSubMode); m_referOfRemoteInProgress = referTransaction->Start(); return m_referOfRemoteInProgress; } @@ -530,18 +531,18 @@ what they told us to use. They can't do the REFER without a username part, but they never gave us a username to give them. Give me a break! */ - SIPURL referTo = sip->GetRemotePartyURL(); - referTo.Sanitise(SIPURL::RedirectURI); - if (remoteProductInfo.name == "Avaya" && referTo.GetUserName().IsEmpty()) - referTo.SetUserName("anonymous"); + m_sentReferTo = sip->GetRemotePartyURL(); + m_sentReferTo.Sanitise(SIPURL::RedirectURI); + if (remoteProductInfo.name == "Avaya" && m_sentReferTo.GetUserName().IsEmpty()) + m_sentReferTo.SetUserName("anonymous"); PStringStream id; id << sip->GetDialog().GetCallID() << ";to-tag=" << sip->GetDialog().GetRemoteTag() << ";from-tag=" << sip->GetDialog().GetLocalTag(); - referTo.SetQueryVar("Replaces", id); + m_sentReferTo.SetQueryVar("Replaces", id); - SIPRefer * referTransaction = new SIPRefer(*this, referTo, m_dialog.GetLocalURI(), referSubMode); + SIPRefer * referTransaction = new SIPRefer(*this, m_sentReferTo, m_dialog.GetLocalURI(), referSubMode); referTransaction->GetMIME().AddSupported("replaces"); m_referOfRemoteInProgress = referTransaction->Start(); return m_referOfRemoteInProgress; @@ -1882,6 +1883,7 @@ PStringToString info; info.SetAt("result", "error"); info.SetAt("party", "B"); + info.SetAt("Refer-To", m_sentReferTo); info.SetAt("code", psprintf("%u", response.GetStatusCode())); OnTransferNotify(info, this); } @@ -2384,14 +2386,14 @@ if (m_ciscoRemotePartyID == newRemotePartyID) { // We did a REFER but remote address did not change party-ID info.SetAt("result", "failed"); - info.SetAt("party", "B"); } else { // We did a REFER and remote address did change party-ID info.SetAt("result", "success"); - info.SetAt("party", "B"); info.SetAt("Remote-Party", newRemotePartyID.AsString()); } + info.SetAt("party", "B"); + info.SetAt("Refer-To", m_sentReferTo); OnTransferNotify(info, this); } else if (m_ciscoRemotePartyID == newRemotePartyID) @@ -2530,6 +2532,7 @@ PCaselessString state = mime.GetSubscriptionState(info); m_referOfRemoteInProgress = state != "terminated"; info.SetAt("party", "B"); // We are B party in consultation transfer + info.SetAt("Refer-To", m_sentReferTo); info.SetAt("state", state); info.SetAt("code", psprintf("%u", code)); info.SetAt("result", m_referOfRemoteInProgress ? "progress" : (code < 300 ? "success" : "failed")); @@ -2899,6 +2902,7 @@ PStringToString info; info.SetAt("result", "blind"); info.SetAt("party", "B"); + info.SetAt("Refer-To", m_sentReferTo); OnTransferNotify(info, this); Release(OpalConnection::EndedByCallForwarded); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-24 17:47:06
|
Revision: 34722 http://sourceforge.net/p/opalvoip/code/34722 Author: rjongbloed Date: 2016-03-24 17:47:03 +0000 (Thu, 24 Mar 2016) Log Message: ----------- Fixed typo for HTML table data align bottom. Modified Paths: -------------- ptlib/trunk/include/ptclib/html.h ptlib/trunk/src/ptclib/html.cxx Modified: ptlib/trunk/include/ptclib/html.h =================================================================== --- ptlib/trunk/include/ptclib/html.h 2016-03-24 10:16:48 UTC (rev 34721) +++ ptlib/trunk/include/ptclib/html.h 2016-03-24 17:47:03 UTC (rev 34722) @@ -609,7 +609,7 @@ AlignRight, AlignJustify, AlignBaseline, - AlignBotton, + AlignBottom, AlignMiddle, AlignTop }; Modified: ptlib/trunk/src/ptclib/html.cxx =================================================================== --- ptlib/trunk/src/ptclib/html.cxx 2016-03-24 10:16:48 UTC (rev 34721) +++ ptlib/trunk/src/ptclib/html.cxx 2016-03-24 17:47:03 UTC (rev 34722) @@ -611,7 +611,7 @@ "align=right", "align=justify", "valign=baseline", - "valign=botton", + "valign=bottom", "valign=middle", "valign=top" }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-24 10:16:49
|
Revision: 34721 http://sourceforge.net/p/opalvoip/code/34721 Author: rjongbloed Date: 2016-03-24 10:16:48 +0000 (Thu, 24 Mar 2016) Log Message: ----------- Removed file from SVN repository that keeps getting generated by "configure" Removed Paths: ------------- opal/trunk/plugins/audio/G.722.1/libg722_1/tests/regression_tests.sh Deleted: opal/trunk/plugins/audio/G.722.1/libg722_1/tests/regression_tests.sh =================================================================== --- opal/trunk/plugins/audio/G.722.1/libg722_1/tests/regression_tests.sh 2016-03-23 14:09:35 UTC (rev 34720) +++ opal/trunk/plugins/audio/G.722.1/libg722_1/tests/regression_tests.sh 2016-03-24 10:16:48 UTC (rev 34721) @@ -1,100 +0,0 @@ -#!/bin/sh -# -# g722_1 - a library for the G.722.1 codec -# -# regression_tests.sh -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2, as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -STDOUT_DEST=xyzzy -STDERR_DEST=xyzzy2 -VECTOR_CLASS=floating -TMP_FILE=tmp - -echo Performing basic G.722_1 regression tests -echo - -./g722_1_tests E I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_in.pcm $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_32000.itu -RETVAL=$? -if [ $RETVAL != 0 ] -then - echo g722_1_tests encode failed! - exit $RETVAL -fi -./g722_1_tests E I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_in.pcm $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_24000.itu -RETVAL=$? -if [ $RETVAL != 0 ] -then - echo g722_1_tests encode failed! - exit $RETVAL -fi -echo g722_1_tests encode completed OK - -./g722_1_tests D I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_24000.itu $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_24000.pcm -RETVAL=$? -if [ $RETVAL != 0 ] -then - echo g722_1_tests decode failed! - exit $RETVAL -fi -./g722_1_tests D I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_32000.itu $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_32000.pcm -RETVAL=$? -if [ $RETVAL != 0 ] -then - echo g722_1_tests decode failed! - exit $RETVAL -fi - -./g722_1_tests D I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_in_24000_fe.itu $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_24000_fe.pcm -RETVAL=$? -if [ $RETVAL != 0 ] -then - echo g722_1_tests decode failed! - exit $RETVAL -fi -./g722_1_tests D I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_in_32000_fe.itu $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_32000_fe.pcm -RETVAL=$? -if [ $RETVAL != 0 ] -then - echo g722_1_tests decode failed! - exit $RETVAL -fi -echo g722_1_tests decode completed OK - -./g722_1_tests E I 32000 16000 ../test-data/local/short_wb_voice.wav $TMP_FILE -RETVAL=$? -if [ $RETVAL != 0 ] -then - echo g722_1_tests encode failed! - exit $RETVAL -fi -echo g722_1_tests encode completed OK - -./g722_1_tests D I 32000 16000 $TMP_FILE test.au -RETVAL=$? -if [ $RETVAL != 0 ] -then - echo g722_1_tests decode failed! - exit $RETVAL -fi -echo g722_1_tests decode completed OK - -echo -echo All regression tests successfully completed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-23 14:09:38
|
Revision: 34720 http://sourceforge.net/p/opalvoip/code/34720 Author: rjongbloed Date: 2016-03-23 14:09:35 +0000 (Wed, 23 Mar 2016) Log Message: ----------- Fixed handling odd resolutions in H.264 encoding. Modified Paths: -------------- opal/trunk/plugins/video/openh264/openh264.cxx opal/trunk/plugins/video/x264/x264wrap.cxx Modified: opal/trunk/plugins/video/openh264/openh264.cxx =================================================================== --- opal/trunk/plugins/video/openh264/openh264.cxx 2016-03-23 11:39:12 UTC (rev 34719) +++ opal/trunk/plugins/video/openh264/openh264.cxx 2016-03-23 14:09:35 UTC (rev 34720) @@ -785,15 +785,18 @@ PluginCodec_RTP from(fromPtr, fromLen); PluginCodec_Video_FrameHeader * header = from.GetVideoHeader(); + unsigned planeWidth = (header->width+1)&~1; + unsigned planeHeight = (header->height+1)&~1; + SSourcePicture picture; picture.iColorFormat = videoFormatI420; // color space type picture.iPicWidth = m_width = header->width; picture.iPicHeight = m_height = header->height; - picture.iStride[0] = picture.iPicWidth; - picture.iStride[1] = picture.iStride[2] = picture.iPicWidth / 2; + picture.iStride[0] = planeWidth; + picture.iStride[1] = picture.iStride[2] = planeWidth/2; picture.pData[0] = from.GetVideoFrameData(); - picture.pData[1] = picture.pData[0] + picture.iPicWidth*picture.iPicHeight; - picture.pData[2] = picture.pData[1] + picture.iPicWidth*picture.iPicHeight / 4; + picture.pData[1] = picture.pData[0] + planeWidth*planeHeight; + picture.pData[2] = picture.pData[1] + planeWidth*planeHeight/4; picture.uiTimeStamp = 0; if (forceIntraFrame) Modified: opal/trunk/plugins/video/x264/x264wrap.cxx =================================================================== --- opal/trunk/plugins/video/x264/x264wrap.cxx 2016-03-23 11:39:12 UTC (rev 34719) +++ opal/trunk/plugins/video/x264/x264wrap.cxx 2016-03-23 14:09:35 UTC (rev 34720) @@ -180,14 +180,14 @@ bool H264Encoder::SetFrameWidth(unsigned width) { - m_context.i_width = width; + m_context.i_width = width&~1; return true; } bool H264Encoder::SetFrameHeight(unsigned height) { - m_context.i_height = height; + m_context.i_height = height&~1; return true; } @@ -314,18 +314,24 @@ return 0; } - if (payloadSize < sizeof(PluginCodec_Video_FrameHeader)+header->width*header->height*3/2) { + unsigned planeWidth = (header->width+1)&~1; + unsigned planeHeight = (header->height+1)&~1; + + if (payloadSize < sizeof(PluginCodec_Video_FrameHeader)+planeWidth*planeHeight*3/2) { PTRACE(1, HelperTraceName, "Video grab far too small, Close down video transmission thread"); return 0; } + unsigned encodeWidth = header->width&~1; + unsigned encodeHeight = header->height&~1; + // if the incoming data has changed size, tell the encoder - if ((unsigned)m_context.i_width != header->width || (unsigned)m_context.i_height != header->height) { + if ((unsigned)m_context.i_width != encodeWidth || (unsigned)m_context.i_height != encodeHeight) { PTRACE(4, HelperTraceName, "Detected resolution change " << m_context.i_width << 'x' << m_context.i_height - << " to " << header->width << 'x' << header->height); + << " to " << encodeWidth << 'x' << encodeHeight << " (" << header->width << 'x' << header->width << ')'); x264_encoder_close(m_codec); - m_context.i_width = header->width; - m_context.i_height = header->height; + m_context.i_width = encodeWidth; + m_context.i_height = encodeHeight; m_codec = x264_encoder_open(&m_context); if (m_codec == NULL) { PTRACE(1, HelperTraceName, "Couldn't re-open encoder"); @@ -339,11 +345,11 @@ x264_picture_init(&inputPicture); inputPicture.i_qpplus1 = 0; inputPicture.img.i_csp = X264_CSP_I420; - inputPicture.img.i_stride[0] = header->width; - inputPicture.img.i_stride[1] = inputPicture.img.i_stride[2] = header->width/2; + inputPicture.img.i_stride[0] = planeWidth; + inputPicture.img.i_stride[1] = inputPicture.img.i_stride[2] = planeWidth/2; inputPicture.img.plane[0] = (uint8_t *)(((unsigned char *)header) + sizeof(PluginCodec_Video_FrameHeader)); - inputPicture.img.plane[1] = inputPicture.img.plane[0] + header->width*header->height; - inputPicture.img.plane[2] = inputPicture.img.plane[1] + header->width*header->height/4; + inputPicture.img.plane[1] = inputPicture.img.plane[0] + planeWidth*planeHeight; + inputPicture.img.plane[2] = inputPicture.img.plane[1] + planeWidth*planeHeight/4; inputPicture.i_type = flags != 0 ? X264_TYPE_IDR : X264_TYPE_AUTO; x264_nal_t *NALUs = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-23 11:39:14
|
Revision: 34719 http://sourceforge.net/p/opalvoip/code/34719 Author: rjongbloed Date: 2016-03-23 11:39:12 +0000 (Wed, 23 Mar 2016) Log Message: ----------- Add default implementation for PServiceProcess::OnControl() on *nix builds. Modified Paths: -------------- ptlib/trunk/include/ptlib/svcproc.h ptlib/trunk/src/ptlib/unix/svcproc.cxx Modified: ptlib/trunk/include/ptlib/svcproc.h =================================================================== --- ptlib/trunk/include/ptlib/svcproc.h 2016-03-23 11:04:13 UTC (rev 34718) +++ ptlib/trunk/include/ptlib/svcproc.h 2016-03-23 11:39:12 UTC (rev 34719) @@ -108,7 +108,7 @@ /** The Control menu option was used in the SysTray menu. */ - virtual void OnControl() = 0; + virtual void OnControl(); //@} /**@name Miscellaneous functions */ Modified: ptlib/trunk/src/ptlib/unix/svcproc.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/svcproc.cxx 2016-03-23 11:04:13 UTC (rev 34718) +++ ptlib/trunk/src/ptlib/unix/svcproc.cxx 2016-03-23 11:39:12 UTC (rev 34719) @@ -552,6 +552,11 @@ } +void PServiceProcess::OnControl() +{ +} + + void PServiceProcess::Terminate() { if (isTerminating) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-23 11:04:15
|
Revision: 34718 http://sourceforge.net/p/opalvoip/code/34718 Author: rjongbloed Date: 2016-03-23 11:04:13 +0000 (Wed, 23 Mar 2016) Log Message: ----------- Fixed being able to set LIBS variable before inclusion of opal.mak in Makefile. Modified Paths: -------------- opal/trunk/make/opal_config.mak.in Modified: opal/trunk/make/opal_config.mak.in =================================================================== --- opal/trunk/make/opal_config.mak.in 2016-03-23 10:32:01 UTC (rev 34717) +++ opal/trunk/make/opal_config.mak.in 2016-03-23 11:04:13 UTC (rev 34718) @@ -72,7 +72,7 @@ CXXFLAGS := @CXXFLAGS@ $(CXXFLAGS) CFLAGS := @CFLAGS@ $(CFLAGS) LDFLAGS := @LDFLAGS@ $(LDFLAGS) -LIBS := @LIBS@ $(LDFLAGS) +LIBS := @LIBS@ $(LIBS) SHARED_CPPFLAGS := @SHARED_CPPFLAGS@ SHARED_LDFLAGS = @SHARED_LDFLAGS@ DEBUG_CPPFLAGS := @DEBUG_CPPFLAGS@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-23 10:32:03
|
Revision: 34717 http://sourceforge.net/p/opalvoip/code/34717 Author: rjongbloed Date: 2016-03-23 10:32:01 +0000 (Wed, 23 Mar 2016) Log Message: ----------- Allow user overide of Q_SUFFIX symbol in make. Modified Paths: -------------- ptlib/trunk/make/pre.mak Modified: ptlib/trunk/make/pre.mak =================================================================== --- ptlib/trunk/make/pre.mak 2016-03-22 13:48:36 UTC (rev 34716) +++ ptlib/trunk/make/pre.mak 2016-03-23 10:32:01 UTC (rev 34717) @@ -87,7 +87,7 @@ ifeq ($(V)$(VERBOSE),) - ifeq ($(DEBUG_BUILD),yes) + ifeq ($(Q_SUFFIX)$(DEBUG_BUILD),yes) Q_SUFFIX := " dbg" endif Q := @ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-22 13:48:39
|
Revision: 34716 http://sourceforge.net/p/opalvoip/code/34716 Author: rjongbloed Date: 2016-03-22 13:48:36 +0000 (Tue, 22 Mar 2016) Log Message: ----------- Fixed "coding style" for PluginCodec_Video_FrameHeader size and ptr calculation functions. Modified Paths: -------------- opal/trunk/samples/callgen/main.cxx opal/trunk/samples/playrtp/main.cxx Modified: opal/trunk/samples/callgen/main.cxx =================================================================== --- opal/trunk/samples/callgen/main.cxx 2016-03-22 13:47:56 UTC (rev 34715) +++ opal/trunk/samples/callgen/main.cxx 2016-03-22 13:48:36 UTC (rev 34716) @@ -739,7 +739,7 @@ OpalVideoTranscoder::FrameHeader * hdr = (OpalVideoTranscoder::FrameHeader *)frame.GetPayloadPtr(); hdr->x = hdr->y = 0; videoFile->GetFrameSize(hdr->width, hdr->height); - videoFile->ReadFrame(OPAL_VIDEO_FRAME_DATA_PTR(hdr)); + videoFile->ReadFrame(OpalVideoFrameDataPtr(hdr)); return true; } Modified: opal/trunk/samples/playrtp/main.cxx =================================================================== --- opal/trunk/samples/playrtp/main.cxx 2016-03-22 13:47:56 UTC (rev 34715) +++ opal/trunk/samples/playrtp/main.cxx 2016-03-22 13:48:36 UTC (rev 34716) @@ -611,17 +611,17 @@ if (extensionData != NULL && extensionId == m_rotateExtensionId) { switch (*extensionData >> 4) { case 0 : // Portrait left - PColourConverter::RotateYUV420P(90, frame->width, frame->height, OPAL_VIDEO_FRAME_DATA_PTR(frame)); + PColourConverter::RotateYUV420P(90, frame->width, frame->height, OpalVideoFrameDataPtr(frame)); std::swap(frame->width, frame->height); break; case 1 : // Landscape up break; case 2 : // Portrait right - PColourConverter::RotateYUV420P(-90, frame->width, frame->height, OPAL_VIDEO_FRAME_DATA_PTR(frame)); + PColourConverter::RotateYUV420P(-90, frame->width, frame->height, OpalVideoFrameDataPtr(frame)); std::swap(frame->width, frame->height); break; case 3 : // Lnadscape down - PColourConverter::RotateYUV420P(180, frame->width, frame->height, OPAL_VIDEO_FRAME_DATA_PTR(frame)); + PColourConverter::RotateYUV420P(180, frame->width, frame->height, OpalVideoFrameDataPtr(frame)); break; } } @@ -631,8 +631,8 @@ m_display->SetFrameSize(frame->width, frame->height); m_display->SetFrameData(frame->x, frame->y, frame->width, frame->height, - OPAL_VIDEO_FRAME_DATA_PTR(frame), data.GetMarker()); - m_yuvFile.WriteFrame(OPAL_VIDEO_FRAME_DATA_PTR(frame)); + OpalVideoFrameDataPtr(frame), data.GetMarker()); + m_yuvFile.WriteFrame(OpalVideoFrameDataPtr(frame)); } else { int extendedHeight = frame->height + m_extraHeight; @@ -643,35 +643,35 @@ extendedFrame->height = extendedHeight; PColourConverter::FillYUV420P(0, 0, extendedFrame->width, extendedFrame->height, - extendedFrame->width, extendedFrame->height, OPAL_VIDEO_FRAME_DATA_PTR(extendedFrame), + extendedFrame->width, extendedFrame->height, OpalVideoFrameDataPtr(extendedFrame), 0, 0, 0); char text[60]; sprintf(text, "Seq:%08u Ts:%08u", rtp.GetSequenceNumber(), rtp.GetTimestamp()); - DrawText(4, 4, extendedFrame->width, extendedFrame->height, OPAL_VIDEO_FRAME_DATA_PTR(extendedFrame), text); + DrawText(4, 4, extendedFrame->width, extendedFrame->height, OpalVideoFrameDataPtr(extendedFrame), text); sprintf(text, "TC:%06u %c %c %c", m_videoFrames, m_vfu ? 'V' : ' ', video->WasLastFrameIFrame() ? 'I' : ' ', m_videoError ? 'E' : ' '); - DrawText(4, 20, extendedFrame->width, extendedFrame->height, OPAL_VIDEO_FRAME_DATA_PTR(extendedFrame), text); + DrawText(4, 20, extendedFrame->width, extendedFrame->height, OpalVideoFrameDataPtr(extendedFrame), text); if (m_extraText.GetLength() > 0) - DrawText(4, 37, extendedFrame->width, extendedFrame->height, OPAL_VIDEO_FRAME_DATA_PTR(extendedFrame), m_extraText); + DrawText(4, 37, extendedFrame->width, extendedFrame->height, OpalVideoFrameDataPtr(extendedFrame), m_extraText); - PColourConverter::CopyYUV420P(0, 0, frame->width, frame->height, frame->width, frame->height, OPAL_VIDEO_FRAME_DATA_PTR(frame), - 0, m_extraHeight, frame->width, frame->height, extendedFrame->width, extendedFrame->height, OPAL_VIDEO_FRAME_DATA_PTR(extendedFrame), + PColourConverter::CopyYUV420P(0, 0, frame->width, frame->height, frame->width, frame->height, OpalVideoFrameDataPtr(frame), + 0, m_extraHeight, frame->width, frame->height, extendedFrame->width, extendedFrame->height, OpalVideoFrameDataPtr(extendedFrame), PVideoFrameInfo::eCropTopLeft); m_display->SetFrameSize(extendedFrame->width, extendedFrame->height); m_display->SetFrameData(extendedFrame->x, extendedFrame->y, extendedFrame->width, extendedFrame->height, - OPAL_VIDEO_FRAME_DATA_PTR(extendedFrame), data.GetMarker()); + OpalVideoFrameDataPtr(extendedFrame), data.GetMarker()); - m_yuvFile.WriteFrame(OPAL_VIDEO_FRAME_DATA_PTR(extendedFrame)); + m_yuvFile.WriteFrame(OpalVideoFrameDataPtr(extendedFrame)); } if (m_info > 1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-22 13:47:59
|
Revision: 34715 http://sourceforge.net/p/opalvoip/code/34715 Author: rjongbloed Date: 2016-03-22 13:47:56 +0000 (Tue, 22 Mar 2016) Log Message: ----------- Added PColourConverter::YUVtoRGB() Modified Paths: -------------- ptlib/trunk/include/ptlib/vconvert.h ptlib/trunk/src/ptlib/common/vconvert.cxx Modified: ptlib/trunk/include/ptlib/vconvert.h =================================================================== --- ptlib/trunk/include/ptlib/vconvert.h 2016-03-21 19:18:02 UTC (rev 34714) +++ ptlib/trunk/include/ptlib/vconvert.h 2016-03-22 13:47:56 UTC (rev 34715) @@ -285,6 +285,13 @@ BYTE & y, BYTE & u, BYTE & v ); + /**Convert YUV to RGB. + */ + static void YUVtoRGB( + unsigned y, unsigned u, unsigned v, + BYTE & r, BYTE & g, BYTE & b + ); + /**Copy a section of the source frame to a section of the destination frame with scaling/cropping as required. */ Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-21 19:18:02 UTC (rev 34714) +++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-22 13:47:56 UTC (rev 34715) @@ -1868,6 +1868,25 @@ * B = Y + 1.772 (Cb-128) * */ + +void PColourConverter::YUVtoRGB(unsigned y, unsigned u, unsigned v, + BYTE & r, BYTE & g, BYTE & b) +{ + FixedPoint cb = u - 128; + FixedPoint cr = v - 128; + FixedPoint rd = ROUND(YUVtoR_Coeff * cr); + FixedPoint gd = ROUND(YUVtoG_Coeff1 * cb - YUVtoG_Coeff2 * cr); + FixedPoint bd = ROUND(YUVtoB_Coeff * cb); + FixedPoint yvalue = y << ScaleBitShift; + FixedPoint rvalue = yvalue + rd; + FixedPoint gvalue = yvalue + gd; + FixedPoint bvalue = yvalue + bd; + r = CLAMP(rvalue); + g = CLAMP(gvalue); + b = CLAMP(bvalue); +} + + bool PStandardColourConverter::YUV420PtoRGB(const BYTE * srcFrameBuffer, BYTE * dstFrameBuffer, PINDEX * bytesReturned, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 19:18:04
|
Revision: 34714 http://sourceforge.net/p/opalvoip/code/34714 Author: rjongbloed Date: 2016-03-21 19:18:02 +0000 (Mon, 21 Mar 2016) Log Message: ----------- More handling of odd video resolutions. Modified Paths: -------------- ptlib/trunk/src/ptlib/common/vconvert.cxx Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-21 18:08:39 UTC (rev 34713) +++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-21 19:18:02 UTC (rev 34714) @@ -943,13 +943,13 @@ unsigned planeWidth = (frameWidth+1)&~1; unsigned planeHeight = (frameHeight+1)&~1; - unsigned char * Yptr = yuv + ( y * planeWidth ) + x; - unsigned char * Uptr = yuv + (planeWidth * planeHeight) + ( (y * planeWidth) >> 2) + (x >> 1); - unsigned char * Vptr = Uptr + planeWidth * planeHeight / 4; - int halfRectWidth = width/2; int halfPlaneWidth = planeWidth/2; + unsigned char * Yptr = yuv + y*planeWidth + x; + unsigned char * Uptr = yuv + (planeWidth * planeHeight) + y/2*halfPlaneWidth + x/2; + unsigned char * Vptr = Uptr + planeWidth * planeHeight / 4; + for (unsigned dy = 0; dy < height; dy += 2) { memset(Yptr, Y, width); Yptr += planeWidth; @@ -1883,7 +1883,9 @@ if (bytesReturned != NULL) *bytesReturned = m_dstFrameBytes; - unsigned yPlaneSize = m_srcFrameWidth*m_srcFrameHeight; + unsigned planeWidth = (m_srcFrameWidth+1)&~1; + unsigned planeHeight = (m_srcFrameHeight+1)&~1; + unsigned yPlaneSize = planeWidth*planeHeight; const BYTE * scanLinePtrY = srcFrameBuffer; // 1 byte Y (luminance) for each pixel const BYTE * scanLinePtrU = scanLinePtrY+yPlaneSize; // 1 byte U for a block of 4 pixels const BYTE * scanLinePtrV = scanLinePtrU+yPlaneSize/4; // 1 byte V for a block of 4 pixels @@ -1917,7 +1919,7 @@ BYTE * scanLinePtrRGB = dstFrameBuffer; int scanLineSizeRGB = (int)((rgbIncrement*m_dstFrameWidth+3)&~3); - unsigned srcPixpos[4] = { 0, 1, m_srcFrameWidth, m_srcFrameWidth + 1 }; + unsigned srcPixpos[4] = { 0, 1, planeWidth, planeWidth + 1 }; unsigned dstPixpos[4] = { 0, rgbIncrement, (unsigned)scanLineSizeRGB, (unsigned)scanLineSizeRGB+rgbIncrement }; if (m_verticalFlip) { @@ -1952,8 +1954,9 @@ for (unsigned y = 0; y < m_srcFrameHeight; y += 2) { BYTE * pixelRGB = scanLinePtrRGB; for (unsigned x = 0; x < m_srcFrameWidth; x += 2) { + unsigned pixels = x < m_srcFrameWidth-1 ? 4 : 2; YUV420PtoRGB_PIXEL_UV(scanLinePtrU, scanLinePtrV); - for (unsigned p = 0; p < 4; p++) { + for (unsigned p = 0; p < pixels; p++) { BYTE * rgbPtr = pixelRGB + dstPixpos[p]; YUV420PtoRGB_PIXEL_RGB(scanLinePtrY); if (rgbIncrement == 4) @@ -1965,12 +1968,12 @@ scanLinePtrV++; } scanLinePtrRGB += scanLineSizeRGB; - scanLinePtrY += m_srcFrameWidth; + scanLinePtrY += planeWidth; } } else { - unsigned scanLineSizeY = m_srcFrameWidth*2; // Actually two scan lines - unsigned scanLineSizeUV = m_srcFrameWidth/2; + unsigned scanLineSizeY = planeWidth*2; // Actually two scan lines + unsigned scanLineSizeUV = planeWidth/2; PRasterDutyCycle raster(m_resizeMode, m_srcFrameWidth, m_srcFrameHeight, m_dstFrameWidth, m_dstFrameHeight, 2, 2); do { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 18:08:42
|
Revision: 34713 http://sourceforge.net/p/opalvoip/code/34713 Author: rjongbloed Date: 2016-03-21 18:08:39 +0000 (Mon, 21 Mar 2016) Log Message: ----------- Fixed PVideoFrameInfo::CalculateFrameBytes() for YUV420P and odd resolutions, part 2. Modified Paths: -------------- ptlib/trunk/src/ptlib/common/videoio.cxx Modified: ptlib/trunk/src/ptlib/common/videoio.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/videoio.cxx 2016-03-21 18:05:05 UTC (rev 34712) +++ ptlib/trunk/src/ptlib/common/videoio.cxx 2016-03-21 18:08:39 UTC (rev 34713) @@ -45,44 +45,56 @@ const PString & PVideoFrameInfo::YUV420P() { static PConstString const s(PTLIB_VIDEO_YUV420P); return s; } +static PINDEX CalculateFrameBytesYUV420P(unsigned width, unsigned height) +{ + // Need to round up with Y plane + return ((width+1)&~1) * ((height+1)&~1) *3 / 2; +} + +static PINDEX CalculateFrameBytesRGB24(unsigned width, unsigned height) +{ + return ((width*3+3)&~3) * height; +} + //Colour format bit per pixel table. // These are in rough order of colour gamut size and "popularity" static struct { const char * colourFormat; unsigned bitsPerPixel; - unsigned alignmentMinus1; // Power of 2 minus 1 + PINDEX (*calculate)(unsigned width, unsigned height); PINDEX CalculateFrameBytes(unsigned width, unsigned height) { - return (((width * bitsPerPixel / 8) + alignmentMinus1) & ~alignmentMinus1) - * ((height + alignmentMinus1) & ~alignmentMinus1); + if (calculate) + return calculate(width, height); + return (width * bitsPerPixel / 8) * height; } } ColourFormatBPPTab[] = { - { PTLIB_VIDEO_YUV420P, 12, 1 }, - { "I420", 12, 1 }, - { "IYUV", 12, 1 }, - { "YUV420", 12, 1 }, - { "RGB32", 32, 3 }, - { "BGR32", 32, 3 }, - { "RGB24", 24, 3 }, - { "BGR24", 24, 3 }, - { "YUY2", 16, 0 }, - { "YUV422", 16, 0 }, - { "YUV422P", 16, 0 }, - { "YUV411", 12, 0 }, - { "YUV411P", 12, 0 }, - { "RGB565", 16, 3 }, - { "RGB555", 16, 3 }, - { "RGB16", 16, 1 }, - { "YUV410", 10, 0 }, - { "YUV410P", 10, 0 }, - { "Grey", 8, 0 }, - { "GreyF", 8, 0 }, - { "UYVY422", 16, 1 }, - { "UYV444", 24, 0 }, - { "SBGGR8", 8, 0 }, - { "JPEG", 24, 0 }, - { "MJPEG", 8, 0 } + { PTLIB_VIDEO_YUV420P, 12, CalculateFrameBytesYUV420P }, + { "I420", 12, CalculateFrameBytesYUV420P }, + { "IYUV", 12, CalculateFrameBytesYUV420P }, + { "YUV420", 12 }, + { "RGB32", 32 }, + { "BGR32", 32 }, + { "RGB24", 24, CalculateFrameBytesRGB24 }, + { "BGR24", 24, CalculateFrameBytesRGB24 }, + { "YUY2", 16 }, + { "YUV422", 16 }, + { "YUV422P", 16 }, + { "YUV411", 12 }, + { "YUV411P", 12 }, + { "RGB565", 16 }, + { "RGB555", 16 }, + { "RGB16", 16 }, + { "YUV410", 10 }, + { "YUV410P", 10 }, + { "Grey", 8 }, + { "GreyF", 8 }, + { "UYVY422", 16 }, + { "UYV444", 24 }, + { "SBGGR8", 8 }, + { "JPEG", 24 }, + { "MJPEG", 8 } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 18:05:08
|
Revision: 34712 http://sourceforge.net/p/opalvoip/code/34712 Author: rjongbloed Date: 2016-03-21 18:05:05 +0000 (Mon, 21 Mar 2016) Log Message: ----------- More handling of odd video resolutions. Modified Paths: -------------- opal/trunk/plugins/video/VP8-WebM/vp8_webm.cxx Modified: opal/trunk/plugins/video/VP8-WebM/vp8_webm.cxx =================================================================== --- opal/trunk/plugins/video/VP8-WebM/vp8_webm.cxx 2016-03-21 17:38:00 UTC (rev 34711) +++ opal/trunk/plugins/video/VP8-WebM/vp8_webm.cxx 2016-03-21 18:05:05 UTC (rev 34712) @@ -520,11 +520,6 @@ if (m_config.g_w == m_width && m_config.g_h == m_height) return !IS_ERROR(vpx_codec_enc_config_set, (&m_codec, &m_config)); - if (((m_width|m_height) & 1) != 0) { - PTRACE(1, MY_CODEC_LOG, "Odd width or height provided: " << m_width << 'x' << m_height); - return false; - } - m_config.g_w = m_width; m_config.g_h = m_height; vpx_codec_destroy(&m_codec); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 17:38:03
|
Revision: 34711 http://sourceforge.net/p/opalvoip/code/34711 Author: rjongbloed Date: 2016-03-21 17:38:00 +0000 (Mon, 21 Mar 2016) Log Message: ----------- More handling of odd video resolutions. Modified Paths: -------------- ptlib/trunk/src/ptlib/common/vconvert.cxx Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-21 16:06:49 UTC (rev 34710) +++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-21 17:38:00 UTC (rev 34711) @@ -675,13 +675,6 @@ return false; } - if ((srcFrameWidth | dstFrameWidth | srcFrameHeight | dstFrameHeight) & 1) { - if (error != NULL) - *error << "Dimensions must be even: " - << srcFrameWidth << 'x' << srcFrameHeight << " -> " << dstFrameWidth << 'x' << dstFrameHeight; - return false; - } - if (srcFrameWidth <= dstFrameWidth && srcFrameHeight <= dstFrameHeight) return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 16:06:52
|
Revision: 34710 http://sourceforge.net/p/opalvoip/code/34710 Author: rjongbloed Date: 2016-03-21 16:06:49 +0000 (Mon, 21 Mar 2016) Log Message: ----------- More handling of odd video resolutions. Modified Paths: -------------- ptlib/trunk/src/ptlib/common/vconvert.cxx Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-21 15:37:53 UTC (rev 34709) +++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-21 16:06:49 UTC (rev 34710) @@ -705,7 +705,7 @@ srcWidth == dstWidth && srcHeight == dstHeight && srcFrameWidth == dstFrameWidth && srcFrameHeight == dstFrameHeight && srcWidth == srcFrameWidth && srcHeight == srcFrameHeight) { - memcpy(dstYUV, srcYUV, srcFrameWidth*srcFrameHeight*3/2); + memcpy(dstYUV, srcYUV, PVideoFrameInfo::CalculateFrameBytes(dstFrameWidth, dstFrameHeight)); return true; } @@ -746,6 +746,11 @@ return false; } + srcFrameWidth = (srcFrameWidth+1)&~1; + srcFrameHeight = (srcFrameHeight+1)&~1; + dstFrameWidth = (dstFrameWidth+1)&~1; + dstFrameHeight = (dstFrameHeight+1)&~1; + void(*rowFunction)(const BYTE * srcPtr, unsigned srcWidth, unsigned srcHeight, unsigned srcLineSpan, BYTE * dstPtr, unsigned dstWidth, unsigned dstHeight, int dstFrameWidth) = CropYUV420P; @@ -868,6 +873,8 @@ if (dstYUV == NULL || srcYUV == dstYUV) dstYUV = storage.GetPointer(size); + width = (width+1)&~1; + height = (height+1)&~1; struct PlaneInfo { unsigned int width; unsigned int height; @@ -927,6 +934,11 @@ unsigned frameWidth, unsigned frameHeight, BYTE * yuv, unsigned r, unsigned g, unsigned b) { + if (frameWidth == 0) + frameWidth = width; + if (frameHeight == 0) + frameHeight = height; + if (frameWidth == 0 || frameHeight == 0 || x + width > frameWidth || y + height > frameHeight) { PAssertAlways(PInvalidParameter); return false; @@ -935,29 +947,27 @@ BYTE Y, U, V; PColourConverter::RGBtoYUV(r, g, b, Y, U, V); - x &= 0xfffffffe; // Make sure is even + unsigned planeWidth = (frameWidth+1)&~1; + unsigned planeHeight = (frameHeight+1)&~1; - int offset = ( y * frameWidth ) + x; - int colourOffset = ( (y * frameWidth) >> 2) + (x >> 1); + unsigned char * Yptr = yuv + ( y * planeWidth ) + x; + unsigned char * Uptr = yuv + (planeWidth * planeHeight) + ( (y * planeWidth) >> 2) + (x >> 1); + unsigned char * Vptr = Uptr + planeWidth * planeHeight / 4; - unsigned char * Yptr = yuv + offset; - unsigned char * Uptr = yuv + (frameWidth * frameHeight) + colourOffset; - unsigned char * Vptr = yuv + (frameWidth * frameHeight) + (frameWidth * frameHeight/4) + colourOffset; + int halfRectWidth = width/2; + int halfPlaneWidth = planeWidth/2; - int halfRectWidth = width/2; - int halfFrameWidth = frameWidth/2; - for (unsigned dy = 0; dy < height; dy += 2) { memset(Yptr, Y, width); - Yptr += frameWidth; + Yptr += planeWidth; memset(Yptr, Y, width); - Yptr += frameWidth; + Yptr += planeWidth; memset(Uptr, U, halfRectWidth); memset(Vptr, V, halfRectWidth); - Uptr += halfFrameWidth; - Vptr += halfFrameWidth; + Uptr += halfPlaneWidth; + Vptr += halfPlaneWidth; } return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 15:37:56
|
Revision: 34709 http://sourceforge.net/p/opalvoip/code/34709 Author: rjongbloed Date: 2016-03-21 15:37:53 +0000 (Mon, 21 Mar 2016) Log Message: ----------- Restored backward compatibility function. Modified Paths: -------------- opal/trunk/include/codec/opalplugin.h Modified: opal/trunk/include/codec/opalplugin.h =================================================================== --- opal/trunk/include/codec/opalplugin.h 2016-03-21 14:49:38 UTC (rev 34708) +++ opal/trunk/include/codec/opalplugin.h 2016-03-21 15:37:53 UTC (rev 34709) @@ -941,7 +941,7 @@ } // For backward compatibility -inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR1(const PluginCodec_Video_FrameHeader * base) +inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR(const PluginCodec_Video_FrameHeader * base) { return OpalVideoFrameDataPtr(base); } extern "C" { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 14:49:41
|
Revision: 34708 http://sourceforge.net/p/opalvoip/code/34708 Author: rjongbloed Date: 2016-03-21 14:49:38 +0000 (Mon, 21 Mar 2016) Log Message: ----------- Fixed handling of video resolution with odd numbers in decoders. Modified Paths: -------------- opal/trunk/include/codec/opalplugin.hpp Modified: opal/trunk/include/codec/opalplugin.hpp =================================================================== --- opal/trunk/include/codec/opalplugin.hpp 2016-03-21 14:47:03 UTC (rev 34707) +++ opal/trunk/include/codec/opalplugin.hpp 2016-03-21 14:49:38 UTC (rev 34708) @@ -1049,7 +1049,7 @@ virtual size_t GetRawFrameSize(unsigned width, unsigned height) { - return width*height*3/2; // YUV420P + return OpalDataSizeYUV420P(width, height); // YUV420P } @@ -1216,6 +1216,8 @@ if (!CanOutputImage(width, height, rtp, flags)) return 0; + width = (width+1)&~1; + height = (height+1)&~1; size_t ySize = width*height; size_t uvSize = ySize/4; if (planes[1] == planes[0]+ySize && planes[2] == planes[1]+uvSize) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 14:47:05
|
Revision: 34707 http://sourceforge.net/p/opalvoip/code/34707 Author: rjongbloed Date: 2016-03-21 14:47:03 +0000 (Mon, 21 Mar 2016) Log Message: ----------- Fixed "coding style" for PluginCodec_Video_FrameHeader size and ptr calculation functions. Modified Paths: -------------- opal/trunk/include/codec/opalplugin.h opal/trunk/samples/codectest/main.cxx opal/trunk/src/codec/opalpluginmgr.cxx opal/trunk/src/codec/rfc4175.cxx opal/trunk/src/ep/opalmixer.cxx opal/trunk/src/opal/mediastrm.cxx opal/trunk/src/opal/recording.cxx Modified: opal/trunk/include/codec/opalplugin.h =================================================================== --- opal/trunk/include/codec/opalplugin.h 2016-03-21 13:37:59 UTC (rev 34706) +++ opal/trunk/include/codec/opalplugin.h 2016-03-21 14:47:03 UTC (rev 34707) @@ -428,7 +428,18 @@ #define PLUGINCODEC_SQCIF_WIDTH 128 #define PLUGINCODEC_SQCIF_HEIGHT 96 +#ifdef __cplusplus +}; +inline size_t OpalDataSizeYUV420P(unsigned width, unsigned height) +{ + return ((width+1)&~1) * ((height+1)&~1) * 3 / 2; +} + +extern "C" { +#endif + + #ifndef __TIMESTAMP__ #define __TIMESTAMP__ "0" #endif @@ -914,12 +925,25 @@ #ifdef __cplusplus }; -inline size_t OPAL_VIDEO_FRAME_DATA_SIZE(const PluginCodec_Video_FrameHeader * base) -{ return ((base->width-base->x+1)&~1) * ((base->height-base->y+1)&~1) + sizeof(PluginCodec_Video_FrameHeader); } +inline size_t OpalVideoFrameSizeForResolution(unsigned width, unsigned height) +{ + return sizeof(PluginCodec_Video_FrameHeader) + OpalDataSizeYUV420P(width, height); +} -inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR(const PluginCodec_Video_FrameHeader * base) -{ return (((unsigned char *)base) + sizeof(PluginCodec_Video_FrameHeader)); } +inline size_t OpalVideoFrameDataLen(const PluginCodec_Video_FrameHeader * base) +{ + return OpalVideoFrameSizeForResolution(base->width - base->x, base->height - base->y); +} +inline unsigned char * OpalVideoFrameDataPtr(const PluginCodec_Video_FrameHeader * base) +{ + return (((unsigned char *)base) + sizeof(PluginCodec_Video_FrameHeader)); +} + +// For backward compatibility +inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR1(const PluginCodec_Video_FrameHeader * base) +{ return OpalVideoFrameDataPtr(base); } + extern "C" { #endif Modified: opal/trunk/samples/codectest/main.cxx =================================================================== --- opal/trunk/samples/codectest/main.cxx 2016-03-21 13:37:59 UTC (rev 34706) +++ opal/trunk/samples/codectest/main.cxx 2016-03-21 14:47:03 UTC (rev 34707) @@ -1278,9 +1278,9 @@ frame->x = frame->y = 0; frame->width = width; frame->height = height; - data.SetPayloadSize(OPAL_VIDEO_FRAME_DATA_SIZE(frame)); + data.SetPayloadSize(OpalVideoFrameDataLen(frame)); - return m_grabber->GetFrameData(OPAL_VIDEO_FRAME_DATA_PTR(frame)); + return m_grabber->GetFrameData(OpalVideoFrameDataPtr(frame)); } @@ -1292,8 +1292,8 @@ const OpalVideoTranscoder::FrameHeader * frame = (const OpalVideoTranscoder::FrameHeader *)data.GetPayloadPtr(); m_display->SetFrameSize(frame->width, frame->height); return m_display->SetFrameData(frame->x, frame->y, - frame->width, frame->height, - OPAL_VIDEO_FRAME_DATA_PTR(frame), data.GetMarker()); + frame->width, frame->height, + OpalVideoFrameDataPtr(frame), data.GetMarker()); } Modified: opal/trunk/src/codec/opalpluginmgr.cxx =================================================================== --- opal/trunk/src/codec/opalpluginmgr.cxx 2016-03-21 13:37:59 UTC (rev 34706) +++ opal/trunk/src/codec/opalpluginmgr.cxx 2016-03-21 14:47:03 UTC (rev 34707) @@ -1192,7 +1192,7 @@ return false; } - if (payloadSize < OPAL_VIDEO_FRAME_DATA_SIZE(videoHeader)) { + if (payloadSize < OpalVideoFrameDataLen(videoHeader)) { PTRACE(1, "OpalPlugin\tInvalid video frame size, error in plug in\n" << *m_bufferRTP); return false; } Modified: opal/trunk/src/codec/rfc4175.cxx =================================================================== --- opal/trunk/src/codec/rfc4175.cxx 2016-03-21 13:37:59 UTC (rev 34706) +++ opal/trunk/src/codec/rfc4175.cxx 2016-03-21 14:47:03 UTC (rev 34707) @@ -533,7 +533,7 @@ hdr->width = m_frameWidth; hdr->height = m_frameHeight; - BYTE * payload = OPAL_VIDEO_FRAME_DATA_PTR(hdr); + BYTE * payload = OpalVideoFrameDataPtr(hdr); BYTE * dstYPlane = payload; BYTE * dstCbPlane = dstYPlane + (m_frameWidth * m_frameHeight); BYTE * dstCrPlane = dstCbPlane + (m_frameWidth * m_frameHeight / 4); @@ -646,7 +646,7 @@ hdr->width = m_frameWidth; hdr->height = m_frameHeight; - BYTE * rgbDest = OPAL_VIDEO_FRAME_DATA_PTR(hdr); + BYTE * rgbDest = OpalVideoFrameDataPtr(hdr); // pass through all of the input frames, and extract information PINDEX f = 0; Modified: opal/trunk/src/ep/opalmixer.cxx =================================================================== --- opal/trunk/src/ep/opalmixer.cxx 2016-03-21 13:37:59 UTC (rev 34706) +++ opal/trunk/src/ep/opalmixer.cxx 2016-03-21 14:47:03 UTC (rev 34707) @@ -600,7 +600,7 @@ PluginCodec_Video_FrameHeader * video = (PluginCodec_Video_FrameHeader *)frame.GetPayloadPtr(); video->width = m_width; video->height = m_height; - memcpy(OPAL_VIDEO_FRAME_DATA_PTR(video), m_frameStore, m_frameStore.GetSize()); + memcpy(OpalVideoFrameDataPtr(video), m_frameStore, m_frameStore.GetSize()); return true; } @@ -758,7 +758,7 @@ << " -> " << x << ',' << y << '/' << w << 'x' << h); PColourConverter::CopyYUV420P(0, 0, header->width, header->height, - header->width, header->height, OPAL_VIDEO_FRAME_DATA_PTR(header), + header->width, header->height, OpalVideoFrameDataPtr(header), x, y, w, h, m_mixer.m_width, m_mixer.m_height, m_mixer.m_frameStore.GetPointer(), PVideoFrameInfo::eScale); @@ -1987,9 +1987,9 @@ resized->width = width; resized->height = height; PColourConverter::CopyYUV420P(0, 0, header->width, header->height, - header->width, header->height, OPAL_VIDEO_FRAME_DATA_PTR(header), + header->width, header->height, OpalVideoFrameDataPtr(header), 0, 0, width, height, - width, height, OPAL_VIDEO_FRAME_DATA_PTR(resized), + width, height, OpalVideoFrameDataPtr(resized), PVideoFrameInfo::eScale); } } Modified: opal/trunk/src/opal/mediastrm.cxx =================================================================== --- opal/trunk/src/opal/mediastrm.cxx 2016-03-21 13:37:59 UTC (rev 34706) +++ opal/trunk/src/opal/mediastrm.cxx 2016-03-21 14:47:03 UTC (rev 34707) @@ -1339,7 +1339,7 @@ bool keyFrame = m_needKeyFrame; PINDEX bytesReturned = size - sizeof(OpalVideoTranscoder::FrameHeader); - BYTE * frameData = OPAL_VIDEO_FRAME_DATA_PTR(frame); + BYTE * frameData = OpalVideoFrameDataPtr(frame); if (!m_inputDevice->GetFrameData(frameData, &bytesReturned, keyFrame)) { PTRACE(2, "Failed to grab frame from " << m_inputDevice->GetDeviceName()); return false; @@ -1406,7 +1406,7 @@ return false; } - ApplyWatermark(frame->width, frame->height, OPAL_VIDEO_FRAME_DATA_PTR(frame)); + ApplyWatermark(frame->width, frame->height, OpalVideoFrameDataPtr(frame)); if (!m_outputDevice->Start()) { PTRACE(1, "Could not start video display device"); @@ -1416,7 +1416,7 @@ bool keyFrameNeeded = false; if (!m_outputDevice->SetFrameData(frame->x, frame->y, frame->width, frame->height, - OPAL_VIDEO_FRAME_DATA_PTR(frame), + OpalVideoFrameDataPtr(frame), marker, keyFrameNeeded)) return false; Modified: opal/trunk/src/opal/recording.cxx =================================================================== --- opal/trunk/src/opal/recording.cxx 2016-03-21 13:37:59 UTC (rev 34706) +++ opal/trunk/src/opal/recording.cxx 2016-03-21 14:47:03 UTC (rev 34707) @@ -690,7 +690,7 @@ } PINDEX bytesReturned = PVideoFrameInfo::CalculateFrameBytes(m_options.m_videoWidth, m_options.m_videoHeight); - if (m_videoConverter != NULL && !m_videoConverter->Convert(OPAL_VIDEO_FRAME_DATA_PTR(header), m_videoBuffer.GetPointer(), &bytesReturned)) { + if (m_videoConverter != NULL && !m_videoConverter->Convert(OpalVideoFrameDataPtr(header), m_videoBuffer.GetPointer(), &bytesReturned)) { PTRACE(2, "Conversion of YUV420P to RGB24 failed!"); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 13:38:02
|
Revision: 34706 http://sourceforge.net/p/opalvoip/code/34706 Author: rjongbloed Date: 2016-03-21 13:37:59 +0000 (Mon, 21 Mar 2016) Log Message: ----------- Fixed "no trace" build. Modified Paths: -------------- ptlib/trunk/include/ptclib/threadpool.h ptlib/trunk/src/ptlib/common/osutils.cxx Modified: ptlib/trunk/include/ptclib/threadpool.h =================================================================== --- ptlib/trunk/include/ptclib/threadpool.h 2016-03-21 12:13:06 UTC (rev 34705) +++ ptlib/trunk/include/ptclib/threadpool.h 2016-03-21 13:37:59 UTC (rev 34706) @@ -490,7 +490,7 @@ bool m_working; }; - virtual void OnMaxWaitTime(const PTimeInterval & PTRACE_PARAM(latency), const string & PTRACE_PARAM(group)) + virtual void OnMaxWaitTime(const PTimeInterval & latency, const string & PTRACE_PARAM(group)) { PTime now; if (this->m_nextWorkerIncreaseTime > now) { Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-03-21 12:13:06 UTC (rev 34705) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-03-21 13:37:59 UTC (rev 34706) @@ -2985,7 +2985,7 @@ #if PTRACING PTRACE_BEGIN(0, "PTLib") << "Assertion fail: Released phantom deadlock in " << mutex << PTrace::End; #else - PAssertAlways(PSTRSTRM("Released phantom deadlock in mutex " << *this)); + PAssertAlways(PSTRSTRM("Released phantom deadlock in mutex " << mutex)); #endif m_excessiveLockActive = false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 12:13:09
|
Revision: 34705 http://sourceforge.net/p/opalvoip/code/34705 Author: rjongbloed Date: 2016-03-21 12:13:06 +0000 (Mon, 21 Mar 2016) Log Message: ----------- Remove hard coded YUV420P buffer size calculations and sse PVideoFrameInfo::CalculateFrameBytes() which deals correctly with odd width/height . Modified Paths: -------------- opal/trunk/include/codec/opalplugin.h opal/trunk/samples/codectest/main.cxx opal/trunk/samples/playrtp/main.cxx opal/trunk/src/codec/opalpluginmgr.cxx opal/trunk/src/ep/opalmixer.cxx opal/trunk/src/opal/recording.cxx Modified: opal/trunk/include/codec/opalplugin.h =================================================================== --- opal/trunk/include/codec/opalplugin.h 2016-03-21 12:10:22 UTC (rev 34704) +++ opal/trunk/include/codec/opalplugin.h 2016-03-21 12:13:06 UTC (rev 34705) @@ -914,8 +914,8 @@ #ifdef __cplusplus }; -inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR(struct PluginCodec_Video_FrameHeader * base) -{ return (((unsigned char *)base) + sizeof(PluginCodec_Video_FrameHeader)); } +inline size_t OPAL_VIDEO_FRAME_DATA_SIZE(const PluginCodec_Video_FrameHeader * base) +{ return ((base->width-base->x+1)&~1) * ((base->height-base->y+1)&~1) + sizeof(PluginCodec_Video_FrameHeader); } inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR(const PluginCodec_Video_FrameHeader * base) { return (((unsigned char *)base) + sizeof(PluginCodec_Video_FrameHeader)); } Modified: opal/trunk/samples/codectest/main.cxx =================================================================== --- opal/trunk/samples/codectest/main.cxx 2016-03-21 12:10:22 UTC (rev 34704) +++ opal/trunk/samples/codectest/main.cxx 2016-03-21 12:13:06 UTC (rev 34705) @@ -1278,7 +1278,7 @@ frame->x = frame->y = 0; frame->width = width; frame->height = height; - data.SetPayloadSize(sizeof(OpalVideoTranscoder::FrameHeader) + width*height*3/2); + data.SetPayloadSize(OPAL_VIDEO_FRAME_DATA_SIZE(frame)); return m_grabber->GetFrameData(OPAL_VIDEO_FRAME_DATA_PTR(frame)); } Modified: opal/trunk/samples/playrtp/main.cxx =================================================================== --- opal/trunk/samples/playrtp/main.cxx 2016-03-21 12:10:22 UTC (rev 34704) +++ opal/trunk/samples/playrtp/main.cxx 2016-03-21 12:13:06 UTC (rev 34705) @@ -637,7 +637,7 @@ else { int extendedHeight = frame->height + m_extraHeight; extendedData.CopyHeader(data); - extendedData.SetPayloadSize(sizeof(OpalVideoTranscoder::FrameHeader) + (frame->width * extendedHeight * 3 / 2)); + extendedData.SetPayloadSize(sizeof(OpalVideoTranscoder::FrameHeader) + PVideoFrameInfo::CalculateFrameBytes(frame->width, extendedHeight))); OpalVideoTranscoder::FrameHeader * extendedFrame = (OpalVideoTranscoder::FrameHeader *)extendedData.GetPayloadPtr(); *extendedFrame = *frame; extendedFrame->height = extendedHeight; Modified: opal/trunk/src/codec/opalpluginmgr.cxx =================================================================== --- opal/trunk/src/codec/opalpluginmgr.cxx 2016-03-21 12:10:22 UTC (rev 34704) +++ opal/trunk/src/codec/opalpluginmgr.cxx 2016-03-21 12:13:06 UTC (rev 34705) @@ -1192,7 +1192,7 @@ return false; } - if (payloadSize < sizeof(OpalVideoTranscoder::FrameHeader)+videoHeader->width*videoHeader->height*3/2) { + if (payloadSize < OPAL_VIDEO_FRAME_DATA_SIZE(videoHeader)) { PTRACE(1, "OpalPlugin\tInvalid video frame size, error in plug in\n" << *m_bufferRTP); return false; } Modified: opal/trunk/src/ep/opalmixer.cxx =================================================================== --- opal/trunk/src/ep/opalmixer.cxx 2016-03-21 12:10:22 UTC (rev 34704) +++ opal/trunk/src/ep/opalmixer.cxx 2016-03-21 12:13:06 UTC (rev 34705) @@ -577,7 +577,7 @@ m_width = width; m_height = height; PColourConverter::FillYUV420P(0, 0, m_width, m_height, m_width, m_height, - m_frameStore.GetPointer(m_width*m_height*3/2), + m_frameStore.GetPointer(PVideoFrameInfo::CalculateFrameBytes(m_width, m_height)), m_bgFillRed, m_bgFillGreen, m_bgFillBlue); m_mutex.Signal(); @@ -1982,7 +1982,7 @@ PTRACE(5, "Scaling video frame: " << header->width << 'x' << header->height << " to " << width << 'x' << height); rawRTP = &cachedFrameStore[frameStoreKey]; rawRTP->CopyHeader(*output); - rawRTP->SetPayloadSize(width*height*3/2+sizeof(OpalVideoTranscoder::FrameHeader)); + rawRTP->SetPayloadSize(PVideoFrameInfo::CalculateFrameBytes(width, height)+sizeof(OpalVideoTranscoder::FrameHeader)); OpalVideoTranscoder::FrameHeader * resized = (OpalVideoTranscoder::FrameHeader *)rawRTP->GetPayloadPtr(); resized->width = width; resized->height = height; Modified: opal/trunk/src/opal/recording.cxx =================================================================== --- opal/trunk/src/opal/recording.cxx 2016-03-21 12:10:22 UTC (rev 34704) +++ opal/trunk/src/opal/recording.cxx 2016-03-21 12:13:06 UTC (rev 34705) @@ -689,7 +689,7 @@ return false; } - PINDEX bytesReturned = m_options.m_videoWidth*m_options.m_videoHeight*3/2; + PINDEX bytesReturned = PVideoFrameInfo::CalculateFrameBytes(m_options.m_videoWidth, m_options.m_videoHeight); if (m_videoConverter != NULL && !m_videoConverter->Convert(OPAL_VIDEO_FRAME_DATA_PTR(header), m_videoBuffer.GetPointer(), &bytesReturned)) { PTRACE(2, "Conversion of YUV420P to RGB24 failed!"); return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 12:10:25
|
Revision: 34704 http://sourceforge.net/p/opalvoip/code/34704 Author: rjongbloed Date: 2016-03-21 12:10:22 +0000 (Mon, 21 Mar 2016) Log Message: ----------- Remove hard coded YUV420P buffer size calculations and sse PVideoFrameInfo::CalculateFrameBytes() which deals correctly with odd width/height . Modified Paths: -------------- ptlib/trunk/src/ptlib/common/vconvert.cxx Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-21 11:51:25 UTC (rev 34703) +++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-21 12:10:22 UTC (rev 34704) @@ -853,7 +853,7 @@ if (!PAssert(width > 16 && height > 16, PInvalidParameter)) return false; - unsigned size = width*height*3/2; + unsigned size = PVideoFrameInfo::CalculateFrameBytes(width, height); if (angle == 0) { if (dstYUV != NULL && srcYUV != dstYUV) @@ -3145,7 +3145,7 @@ return width*height; case MY_JPEG_YUV420P : - return width*height*3/2; + return PVideoFrameInfo::CalculateFrameBytes(width, height); default : PAssertAlways(PInvalidParameter); @@ -3193,7 +3193,7 @@ return false; } - if (!Finish(m_temporaryBuffer.GetPointer(nativeWidth*nativeHeight*3/2), nativeWidth, nativeHeight)) + if (!Finish(m_temporaryBuffer.GetPointer(PVideoFrameInfo::CalculateFrameBytes(nativeWidth, nativeHeight)), nativeWidth, nativeHeight)) return false; return CopyYUV420P(0, 0, nativeWidth, nativeHeight, nativeWidth, nativeHeight, m_temporaryBuffer, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 11:51:28
|
Revision: 34703 http://sourceforge.net/p/opalvoip/code/34703 Author: rjongbloed Date: 2016-03-21 11:51:25 +0000 (Mon, 21 Mar 2016) Log Message: ----------- Added PVideoFrameInfo::YUV420P() for the "YUV420P" colour format string. Modified Paths: -------------- opal/trunk/samples/codectest/main.cxx opal/trunk/src/opal/recording.cxx Modified: opal/trunk/samples/codectest/main.cxx =================================================================== --- opal/trunk/samples/codectest/main.cxx 2016-03-21 11:50:28 UTC (rev 34702) +++ opal/trunk/samples/codectest/main.cxx 2016-03-21 11:51:25 UTC (rev 34703) @@ -1286,7 +1286,7 @@ bool VideoThread::Write(const RTP_DataFrame & data) { - if (m_display->GetColourFormat() != "YUV420P") + if (m_display->GetColourFormat() != PVideoFrameInfo::YUV420P()) return m_display->SetFrameData(0, 0, 0, 0, data.GetPayloadPtr(), data.GetMarker()); const OpalVideoTranscoder::FrameHeader * frame = (const OpalVideoTranscoder::FrameHeader *)data.GetPayloadPtr(); Modified: opal/trunk/src/opal/recording.cxx =================================================================== --- opal/trunk/src/opal/recording.cxx 2016-03-21 11:50:28 UTC (rev 34702) +++ opal/trunk/src/opal/recording.cxx 2016-03-21 11:51:25 UTC (rev 34703) @@ -611,7 +611,7 @@ PTRACE(4, "Creating AVI stream for video format '" << m_options.m_videoFormat << '\''); - PVideoFrameInfo yuv(m_options.m_videoWidth, m_options.m_videoHeight, "YUV420P"); + PVideoFrameInfo yuv(m_options.m_videoWidth, m_options.m_videoHeight, PVideoFrameInfo::YUV420P()); PVideoFrameInfo rgb(m_options.m_videoWidth, m_options.m_videoHeight, "BGR24"); AVISTREAMINFO info; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-21 11:50:30
|
Revision: 34702 http://sourceforge.net/p/opalvoip/code/34702 Author: rjongbloed Date: 2016-03-21 11:50:28 +0000 (Mon, 21 Mar 2016) Log Message: ----------- Make sure PVideoFrameInfo::CalculateFrameBytes() deals correctly with odd height on YUV420P colour format. Make sure PStandardColourConverter::RGBtoYUV420P() deals with odd YUV420P destination resolution. Round up to 2 pixels as fundamentally required by format. Added PVideoFrameInfo::YUV420P() for the "YUV420P" colour format string. Modified Paths: -------------- ptlib/trunk/include/ptlib/vconvert.h ptlib/trunk/include/ptlib/videoio.h ptlib/trunk/src/ptclib/pffvdev.cxx ptlib/trunk/src/ptclib/pvfiledev.cxx ptlib/trunk/src/ptclib/pvidfile.cxx ptlib/trunk/src/ptclib/vsdl.cxx ptlib/trunk/src/ptlib/common/vconvert.cxx ptlib/trunk/src/ptlib/common/vfakeio.cxx ptlib/trunk/src/ptlib/common/videoio.cxx ptlib/trunk/src/ptlib/msos/directshow.cxx ptlib/trunk/src/ptlib/msos/vfw.cxx Modified: ptlib/trunk/include/ptlib/vconvert.h =================================================================== --- ptlib/trunk/include/ptlib/vconvert.h 2016-03-19 16:55:07 UTC (rev 34701) +++ ptlib/trunk/include/ptlib/vconvert.h 2016-03-21 11:50:28 UTC (rev 34702) @@ -411,7 +411,7 @@ unsigned width, ///< Output width, zero indicates same is JPEG input unsigned height, ///< Output height, zero indicates same is JPEG input PVideoFrameInfo::ResizeMode resizeMode = PVideoFrameInfo::eScale, ///< How to produce output - const PString & colourFormat = "YUV420P" ///< Output colour format + const PString & colourFormat = PVideoFrameInfo::YUV420P() ///< Output colour format ); /**Construct a JPEG converter. This is used for the PColourConverter factory. Modified: ptlib/trunk/include/ptlib/videoio.h =================================================================== --- ptlib/trunk/include/ptlib/videoio.h 2016-03-19 16:55:07 UTC (rev 34701) +++ ptlib/trunk/include/ptlib/videoio.h 2016-03-21 11:50:28 UTC (rev 34702) @@ -46,6 +46,9 @@ class PColourConverter; +#define PTLIB_VIDEO_YUV420P "YUV420P" + + class PVideoFrameInfo : public PObject { PCLASSINFO(PVideoFrameInfo, PObject); @@ -73,12 +76,14 @@ MaxWidth = 1920, MaxHeight = 1200 }; + static const PString & YUV420P(); + /// Construct video frame information PVideoFrameInfo(); PVideoFrameInfo( unsigned frameWidth, unsigned frameHeight, - const PString & colourFormat = "YUV420P", + const PString & colourFormat = PVideoFrameInfo::YUV420P(), unsigned frameRate = 15, ResizeMode resizeMode = eScale ); @@ -214,9 +219,9 @@ */ PINDEX CalculateFrameBytes() const { return CalculateFrameBytes(frameWidth, frameHeight, colourFormat); } static PINDEX CalculateFrameBytes( - unsigned width, ///< WIdth of frame + unsigned width, ///< Width of frame unsigned height, ///< Height of frame - const PString & colourFormat ///< Colour format of frame + const PString & colourFormat = PVideoFrameInfo::YUV420P() ///< Colour format of frame ); /** Parse a descriptor string for the video format. @@ -355,7 +360,7 @@ "YUV411" YUV 4:1:1 packed "YUV411P" YUV 4:1:1 planar "YUV420" YUV 4:2:0 packed - "YUV420P" YUV 4:2:0 planar + "YUV420P" YUV 4:2:0 planar, use PTLIB_VIDEO_YUV420P or PVideoFrameInfo::YUV420P() "YUV410" YUV 4:1:0 packed "YUV410P" YUV 4:1:0 planar "MJPEG" Motion JPEG Modified: ptlib/trunk/src/ptclib/pffvdev.cxx =================================================================== --- ptlib/trunk/src/ptclib/pffvdev.cxx 2016-03-19 16:55:07 UTC (rev 34701) +++ ptlib/trunk/src/ptclib/pffvdev.cxx 2016-03-21 11:50:28 UTC (rev 34702) @@ -103,7 +103,7 @@ PVideoInputDevice_FFMPEG::PVideoInputDevice_FFMPEG() { - SetColourFormat("YUV420P"); + SetColourFormat(PVideoFrameInfo::YUV420P()); channelNumber = 0; grabCount = 0; SetFrameRate(10); @@ -182,7 +182,7 @@ } // file is now open - m_ffmpegFrameSize = CalculateFrameBytes(m_ffmpegFrameWidth, m_ffmpegFrameHeight, "yuv420p"); + m_ffmpegFrameSize = CalculateFrameBytes(m_ffmpegFrameWidth, m_ffmpegFrameHeight, PVideoFrameInfo::YUV420P()); SetFrameSize(m_ffmpegFrameWidth, m_ffmpegFrameHeight); deviceName = _deviceName; @@ -236,7 +236,7 @@ PBoolean PVideoInputDevice_FFMPEG::SetColourFormat(const PString & newFormat) { - if (!(newFormat *= "YUV420P")) + if (!(newFormat *= PVideoFrameInfo::YUV420P())) return false; return PVideoDevice::SetColourFormat(newFormat); Modified: ptlib/trunk/src/ptclib/pvfiledev.cxx =================================================================== --- ptlib/trunk/src/ptclib/pvfiledev.cxx 2016-03-19 16:55:07 UTC (rev 34701) +++ ptlib/trunk/src/ptclib/pvfiledev.cxx 2016-03-21 11:50:28 UTC (rev 34702) @@ -74,7 +74,7 @@ , m_frameRateAdjust(0) , m_opened(false) { - SetColourFormat("YUV420P"); + SetColourFormat(PVideoFrameInfo::YUV420P()); } @@ -464,7 +464,7 @@ PBoolean PVideoOutputDevice_VideoFile::SetColourFormat(const PString & newFormat) { - return (newFormat *= "YUV420P") && PVideoDevice::SetColourFormat(newFormat); + return (newFormat *= PVideoFrameInfo::YUV420P()) && PVideoDevice::SetColourFormat(newFormat); } Modified: ptlib/trunk/src/ptclib/pvidfile.cxx =================================================================== --- ptlib/trunk/src/ptclib/pvidfile.cxx 2016-03-19 16:55:07 UTC (rev 34701) +++ ptlib/trunk/src/ptclib/pvidfile.cxx 2016-03-21 11:50:28 UTC (rev 34702) @@ -246,7 +246,7 @@ case 'C' : if (param == "C420") - m_videoInfo.SetColourFormat("YUV420P"); + m_videoInfo.SetColourFormat(PVideoFrameInfo::YUV420P()); else if (param == "C422") m_videoInfo.SetColourFormat("YUV422P"); else { Modified: ptlib/trunk/src/ptclib/vsdl.cxx =================================================================== --- ptlib/trunk/src/ptclib/vsdl.cxx 2016-03-19 16:55:07 UTC (rev 34701) +++ ptlib/trunk/src/ptclib/vsdl.cxx 2016-03-21 11:50:28 UTC (rev 34702) @@ -310,7 +310,7 @@ , m_x(0) , m_y(0) { - colourFormat = "YUV420P"; + colourFormat = PVideoFrameInfo::YUV420P(); PTRACE(5, "Constructed."); } @@ -364,7 +364,7 @@ PBoolean PVideoOutputDevice_SDL::SetColourFormat(const PString & colourFormat) { - if (colourFormat *= "YUV420P") + if (colourFormat *= PVideoFrameInfo::YUV420P()) return PVideoOutputDevice::SetColourFormat(colourFormat); return false; Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-19 16:55:07 UTC (rev 34701) +++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-03-21 11:50:28 UTC (rev 34702) @@ -1146,34 +1146,30 @@ unsigned blueOffset) { if (srcFrameBuffer == dstFrameBuffer) { - PTRACE(2,"Cannot do in-place conversion, not implemented."); + PAssertAlways(PUnimplementedFunction); return false; } - if ((m_dstFrameWidth | m_dstFrameHeight) & 1) { - PTRACE(2,"Cannot have odd output width or height."); - return false; - } - static const unsigned greenOffset = 1; const BYTE * scanLinePtrRGB = srcFrameBuffer; int scanLineSizeRGB = (rgbIncrement*m_srcFrameWidth+3)&~3; - unsigned scanLineSizeY = m_dstFrameWidth; + unsigned planeHeight = (m_dstFrameHeight+1)&~1; + unsigned scanLineSizeY = (m_dstFrameWidth+1)&~1; unsigned scanLineSizeUV = scanLineSizeY/2; BYTE * scanLinePtrY = dstFrameBuffer; // 1 byte Y (luminance) for each pixel - BYTE * scanLinePtrU = scanLinePtrY+m_dstFrameHeight*scanLineSizeY; // 1 byte U for a block of 4 pixels - BYTE * scanLinePtrV = scanLinePtrU+m_dstFrameHeight*scanLineSizeUV/2; // 1 byte V for a block of 4 pixels + BYTE * scanLinePtrU = scanLinePtrY+planeHeight*scanLineSizeY; // 1 byte U for a block of 4 pixels + BYTE * scanLinePtrV = scanLinePtrU+planeHeight*scanLineSizeUV/2; // 1 byte V for a block of 4 pixels if (m_verticalFlip) { scanLinePtrRGB += (m_srcFrameHeight - 1) * scanLineSizeRGB; scanLineSizeRGB = -scanLineSizeRGB; } - if (m_srcFrameWidth == m_dstFrameWidth && m_srcFrameHeight == m_dstFrameHeight) { + if (m_srcFrameWidth == scanLineSizeY && m_srcFrameHeight == planeHeight) { int RGBOffset[4] = { 0, (int)rgbIncrement, scanLineSizeRGB, scanLineSizeRGB+(int)rgbIncrement }; - unsigned YUVOffset[4] = { 0, 1, m_dstFrameWidth, m_dstFrameWidth + 1 }; + unsigned YUVOffset[4] = { 0, 1, scanLineSizeY, scanLineSizeY + 1 }; scanLineSizeRGB *= 2; rgbIncrement *= 2; for (unsigned y = 0; y < m_srcFrameHeight; y += 2) { @@ -1203,7 +1199,7 @@ } else { bool evenLine = true; - PRasterDutyCycle raster(m_resizeMode, m_srcFrameWidth, m_srcFrameHeight, m_dstFrameWidth, m_dstFrameHeight, 2, 1); + PRasterDutyCycle raster(m_resizeMode, m_srcFrameWidth, m_srcFrameHeight, scanLineSizeY, planeHeight, 2, 1); do { while (raster.HasDutyY()) { const BYTE * pixelRGB1 = scanLinePtrRGB; @@ -3099,7 +3095,7 @@ bool SetColourSpace(const PCaselessString & colourFormat) { - if (colourFormat == "YUV420P") + if (colourFormat == PVideoFrameInfo::YUV420P()) m_colourSpace = MY_JPEG_YUV420P; else if (colourFormat == "RGB24") m_colourSpace = MY_JPEG_RGB24; @@ -3238,7 +3234,7 @@ PJPEGConverter::PJPEGConverter() - : PColourConverter(PColourPair("JPEG", "YUV420P")) + : PColourConverter(PColourPair("JPEG", PVideoFrameInfo::YUV420P())) , m_context(new Context) { } Modified: ptlib/trunk/src/ptlib/common/vfakeio.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vfakeio.cxx 2016-03-19 16:55:07 UTC (rev 34701) +++ ptlib/trunk/src/ptlib/common/vfakeio.cxx 2016-03-21 11:50:28 UTC (rev 34702) @@ -1614,7 +1614,7 @@ m_internalColourFormat = eRGB32; else if (newFormat *= "RGB24") m_internalColourFormat = eRGB24; - else if (newFormat *= "YUV420P") + else if (newFormat *= PVideoFrameInfo::YUV420P()) m_internalColourFormat = eYUV420P; else if ((newFormat *= "YUV422") || (newFormat *= "YUY2")) m_internalColourFormat = eYUV422; Modified: ptlib/trunk/src/ptlib/common/videoio.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/videoio.cxx 2016-03-19 16:55:07 UTC (rev 34701) +++ ptlib/trunk/src/ptlib/common/videoio.cxx 2016-03-21 11:50:28 UTC (rev 34702) @@ -43,17 +43,25 @@ /////////////////////////////////////////////////////////////////////////////// +const PString & PVideoFrameInfo::YUV420P() { static PConstString const s(PTLIB_VIDEO_YUV420P); return s; } + //Colour format bit per pixel table. // These are in rough order of colour gamut size and "popularity" static struct { const char * colourFormat; unsigned bitsPerPixel; - unsigned alignmentMinus1; + unsigned alignmentMinus1; // Power of 2 minus 1 + + PINDEX CalculateFrameBytes(unsigned width, unsigned height) + { + return (((width * bitsPerPixel / 8) + alignmentMinus1) & ~alignmentMinus1) + * ((height + alignmentMinus1) & ~alignmentMinus1); + } } ColourFormatBPPTab[] = { - { "YUV420P", 12, 0 }, - { "I420", 12, 0 }, - { "IYUV", 12, 0 }, - { "YUV420", 12, 0 }, + { PTLIB_VIDEO_YUV420P, 12, 1 }, + { "I420", 12, 1 }, + { "IYUV", 12, 1 }, + { "YUV420", 12, 1 }, { "RGB32", 32, 3 }, { "BGR32", 32, 3 }, { "RGB24", 24, 3 }, @@ -126,7 +134,7 @@ , sarWidth(1) , sarHeight(1) , frameRate(25) - , colourFormat("YUV420P") + , colourFormat(PVideoFrameInfo::YUV420P()) , resizeMode(eScale) { } @@ -294,7 +302,7 @@ { for (PINDEX i = 0; i < PARRAYSIZE(ColourFormatBPPTab); i++) { if (colourFormat *= ColourFormatBPPTab[i].colourFormat) - return height * ((width * ColourFormatBPPTab[i].bitsPerPixel/8 + ColourFormatBPPTab[i].alignmentMinus1) & (~ColourFormatBPPTab[i].alignmentMinus1)); + return ColourFormatBPPTab[i].CalculateFrameBytes(width, height); } return 0; } @@ -472,7 +480,7 @@ deviceName("#1"), videoFormat(Auto), channelNumber(-1), - colourFormat("YUV420P"), + colourFormat(PVideoFrameInfo::YUV420P()), convertFormat(true), rate(0), width(CIFWidth), Modified: ptlib/trunk/src/ptlib/msos/directshow.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/directshow.cxx 2016-03-19 16:55:07 UTC (rev 34701) +++ ptlib/trunk/src/ptlib/msos/directshow.cxx 2016-03-21 11:50:28 UTC (rev 34702) @@ -300,9 +300,9 @@ { "BGR24", MEDIASUBTYPE_RGB24 }, { "RGB565", MEDIASUBTYPE_RGB565 }, { "RGB555", MEDIASUBTYPE_RGB555 }, - { "YUV420P", MEDIASUBTYPE_IYUV }, // aka I420 - { "YUV420P", MEDIASUBTYPE_I420 }, - { "YUV420P", MEDIASUBTYPE_YV12 }, + { PTLIB_VIDEO_YUV420P, MEDIASUBTYPE_IYUV }, // aka I420 + { PTLIB_VIDEO_YUV420P, MEDIASUBTYPE_I420 }, + { PTLIB_VIDEO_YUV420P, MEDIASUBTYPE_YV12 }, { "YUV411", MEDIASUBTYPE_Y411 }, { "YUV411P", MEDIASUBTYPE_Y41P }, { "YUV410P", MEDIASUBTYPE_YVU9 }, Modified: ptlib/trunk/src/ptlib/msos/vfw.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/vfw.cxx 2016-03-19 16:55:07 UTC (rev 34701) +++ ptlib/trunk/src/ptlib/msos/vfw.cxx 2016-03-21 11:50:28 UTC (rev 34702) @@ -245,7 +245,7 @@ { "RGB555", 15, TRUE, BI_BITFIELDS }, // http://support.microsoft.com/support/kb/articles/q294/8/80.asp - { "YUV420P", 12, FALSE, mmioFOURCC('I','Y','U','V') }, + { PTLIB_VIDEO_YUV420P, 12, FALSE, mmioFOURCC('I','Y','U','V') }, { "IYUV", 12, FALSE, mmioFOURCC('I','Y','U','V') }, // Synonym for IYUV { "I420", 12, FALSE, mmioFOURCC('I','4','2','0') }, // Synonym for IYUV { "YV12", 12, FALSE, mmioFOURCC('Y','V','1','2') }, // same as IYUV except that U and V planes are switched @@ -1001,7 +1001,7 @@ } #endif - return SetFrameRate(frameRate) && SetColourFormatConverter(colourFormat.IsEmpty() ? PString("YUV420P") : colourFormat); + return SetFrameRate(frameRate) && SetColourFormatConverter(colourFormat.IsEmpty() ? PVideoFrameInfo::YUV420P() : colourFormat); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |