Hi Krishna, That sounds plausible. Make sure you're running mpeg2dec with "-o null" so that none of your time is consumed with drawing (aka displaying) the frame.
It's hard to know for sure without seeing the code, but if the output is plausible and if adding up all the individual times is close to the total CPU time of mpeg2dec (measured with "time" or something) and if you're not wasting cycles on displaying the frames, then it's probably right. A more elegant approach might be to always start the new timer at the same place you stop the old timer. That way, you can be sure nothing is falling through the cracks. Note that STATE_PICTURE is for when libmpeg2 is *finished* decoding the Picture header and the Picture coding extension. I think STATE_SLICE is for when libmpeg2 is *finished* decoding the Slice, including all the macroblocks. (For most streams in real life, this means finished decoding the picture.) STATE_END is only for the end of an MPEG-2 sequence -- you're probably not getting STATE_END ever. So a simpler approach might just be to always start the timer (and stop the previous timer) in STATE_SLICE. Again, make sure you're not trying to display the frames as well. Also, best not to call this the "decoding time" -- that's another thing in MPEG-2 that's totally different. Howabout "computation time"? Best, Keith On Fri, 22 Feb 2008, Krishna Prasad wrote: > Hi Keith > > This is in reference to the previous mails which I had send it you asking > for the decoding time. > > The problem was with the code [on the subtraction betwen the stop and start > time between the pictures] as you said. I have > removed the errror and I wanted to ensure, whether the following steps in > the below is the procedure to calculate the decoding time? > > In the function "void decode_mpeg2", in the *CASE STATE_PICTURE*, I start a > timer (t1) and end the timer(t2) in the *CASE STATE_SLICE. *I calculate the > difference in both the timers [t2-t1 = diff] which I suppose is the decoding > time for picture1. > > For picture 2, in the *CASE STATE_END,* I find the difference in the ending > time of picture2 along with the timer t1 and subtract it with the previous > difference [diff] to calculate the decoding time required for frame2. > > All the time values are positive here. > > This is how I am calculating the decoding times for all the frames in the > GOP and I think it works efficiently for closed GOPs. > > I am thankful to you for the replies you have given to me from time to time > which was quite useful. > > If there any more doubts, I will keep you posted. > > I request you to give me a feedback for the same. > > With regards > KrishnaPrasad > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Libmpeg2-devel mailing list Libmpeg2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmpeg2-devel