1 /******************************************************************************
2 *
3 * Copyright (C) 2015 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *****************************************************************************
18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20
21 /**
22 *******************************************************************************
23 * @file
24 * ih264e_time_stamp.c
25 *
26 * @brief
27 * This file contains functions used for source and target time stamp management
28 *
29 * @author
30 * ittiam
31 *
32 * @par List of Functions:
33 * - gcd
34 * - ih264e_get_range
35 * - ih264e_frame_time_get_init_free_memtab
36 * - ih264e_init_frame_time
37 * - ih264e_should_src_be_skipped
38 * - ih264e_time_stamp_get_init_free_memtab
39 * - ih264e_init_time_stamp
40 * - ih264e_update_time_stamp
41 * - ih264e_frame_time_get_src_frame_rate
42 * - ih264e_frame_time_get_tgt_frame_rate
43 * - ih264e_frame_time_get_src_ticks
44 * - ih264e_frame_time_get_tgt_ticks
45 * - ih264e_frame_time_get_src_time
46 * - ih264e_frame_time_get_tgt_time
47 * - ih264e_frame_time_update_src_frame_rate
48 * - ih264e_frame_time_update_tgt_frame_rate
49 * - ih264_time_stamp_update_frame_rate
50 *
51 * @remarks
52 * none
53 *
54 *******************************************************************************
55 */
56
57 /*****************************************************************************/
58 /* File Includes */
59 /*****************************************************************************/
60
61 /* User Include Files */
62 #include "ih264_typedefs.h"
63 #include "iv2.h"
64 #include "ive2.h"
65
66 #include "ih264_defs.h"
67 #include "ih264_mem_fns.h"
68 #include "ih264_padding.h"
69 #include "ih264_structs.h"
70 #include "ih264_trans_quant_itrans_iquant.h"
71 #include "ih264_inter_pred_filters.h"
72 #include "ih264_intra_pred_filters.h"
73 #include "ih264_deblk_edge_filters.h"
74 #include "ih264_cabac_tables.h"
75
76 #include "ime_defs.h"
77 #include "ime_distortion_metrics.h"
78 #include "ime_structs.h"
79
80 #include "irc_mem_req_and_acq.h"
81 #include "irc_cntrl_param.h"
82 #include "irc_frame_info_collector.h"
83 #include "irc_common.h"
84 #include "irc_rate_control_api.h"
85
86 #include "ih264e_error.h"
87 #include "ih264e_defs.h"
88 #include "ih264e_rate_control.h"
89 #include "ih264e_bitstream.h"
90 #include "ih264e_cabac_structs.h"
91 #include "ih264e_structs.h"
92 #include "ih264e_time_stamp.h"
93
94
95 /*****************************************************************************/
96 /* Function Definitions */
97 /*****************************************************************************/
98
99 /**
100 *******************************************************************************
101 *
102 * @brief Function to compute gcd of two numbers
103 *
104 * @par Description
105 * Function to compute gcd of two numbers
106 *
107 * @param[in] i4_x
108 * value 1
109 *
110 * @param[in] i4_y
111 * value 2
112 *
113 * @returns
114 * GCD(value 1, value 2)
115 *
116 * @remarks none
117 *
118 *******************************************************************************
119 */
gcd(WORD32 i4_x,WORD32 i4_y)120 static WORD32 gcd(WORD32 i4_x, WORD32 i4_y)
121 {
122 if (i4_x > i4_y)
123 {
124 i4_x = i4_y + i4_x;
125 i4_y = i4_x - i4_y;
126 i4_x = i4_x - i4_y;
127 }
128 while (i4_y != 0)
129 {
130 WORD32 temp;
131 i4_x = i4_x % i4_y;
132 temp = i4_x;
133 i4_x = i4_y;
134 i4_y = temp;
135 }
136 return (i4_x);
137 }
138
139 /**
140 *******************************************************************************
141 *
142 * @brief Function to determine number of bits required to represent a given
143 * value
144 *
145 * @par Description
146 * This function determines the number of bits required to represent the given
147 * value. It is used to find out number of bits to read when the data size is
148 * not fixed (e.g. vop_time_increment_resolution).
149 *
150 * @param[in] u4_value
151 * Value for which the number of bits required to represent is to be determined
152 *
153 * @param[in] u1_no_of_bits
154 * Represents the value's word type = 8/16/32
155 *
156 * @returns
157 * The number of bits required to represent the given number
158 *
159 * @remarks none
160 *
161 *******************************************************************************
162 */
ih264e_get_range(UWORD32 u4_value,UWORD8 u1_no_of_bits)163 static UWORD8 ih264e_get_range(UWORD32 u4_value, UWORD8 u1_no_of_bits)
164 {
165 UWORD8 count;
166 UWORD32 temp;
167
168 if (u4_value > (UWORD32) ((1 << (u1_no_of_bits >> 1)) - 1))
169 {
170 temp = (1 << (u1_no_of_bits - 1));
171 for (count = 0; count < (u1_no_of_bits >> 1); count++)
172 {
173 if ((temp & u4_value) != 0)
174 {
175 return (UWORD8) (u1_no_of_bits - count);
176 }
177 else
178 {
179 temp >>= 1;
180 }
181 }
182 return 0;
183 }
184 else
185 {
186 temp = (1 << ((u1_no_of_bits >> 1) - 1));
187 for (count = 0; count < ((u1_no_of_bits >> 1) - 1); count++)
188 {
189 if ((temp & u4_value) != 0)
190 {
191 return (UWORD8) ((u1_no_of_bits >> 1) - count);
192 }
193 else
194 {
195 temp >>= 1;
196 }
197 }
198 return 1;
199 }
200 }
201
202 /**
203 *******************************************************************************
204 *
205 * @brief
206 * Function to init frame time memtabs
207 *
208 * @par Description
209 * Function to init frame time memtabs
210 *
211 * @param[in] pps_frame_time
212 * Pointer to frame time contexts
213 *
214 * @param[in] ps_memtab
215 * Pointer to memtab
216 *
217 * @param[in] e_func_type
218 * Function type (get memtabs/init memtabs)
219 *
220 * @returns
221 * none
222 *
223 * @remarks
224 *
225 *******************************************************************************
226 */
ih264e_frame_time_get_init_free_memtab(frame_time_handle * pps_frame_time,itt_memtab_t * ps_memtab,ITT_FUNC_TYPE_E e_func_type)227 WORD32 ih264e_frame_time_get_init_free_memtab(frame_time_handle *pps_frame_time,
228 itt_memtab_t *ps_memtab,
229 ITT_FUNC_TYPE_E e_func_type)
230 {
231 WORD32 i4_mem_tab_idx = 0;
232 frame_time_t s_temp_frame_time_t;
233
234 /* Hack for al alloc, during which we dont have any state memory.
235 Dereferencing can cause issues */
236 if (e_func_type == GET_NUM_MEMTAB || e_func_type == FILL_MEMTAB)
237 (*pps_frame_time) = &s_temp_frame_time_t;
238
239 /* for src rate control state structure */
240 if (e_func_type != GET_NUM_MEMTAB)
241 {
242 fill_memtab(&ps_memtab[i4_mem_tab_idx], sizeof(frame_time_t),
243 ALIGN_128_BYTE, PERSISTENT, DDR);
244 use_or_fill_base(&ps_memtab[0], (void**) pps_frame_time, e_func_type);
245 }
246 i4_mem_tab_idx++;
247
248 return (i4_mem_tab_idx);
249 }
250
251 /**
252 *******************************************************************************
253 *
254 * @brief
255 * Function to init frame time context
256 *
257 * @par Description
258 * Frame time structure stores the time of the source and the target frames to
259 * be encoded. Based on the time we decide whether or not to encode the source
260 * frame
261 *
262 * @param[in] ps_frame_time
263 * Pointer Frame time context
264 *
265 * @param[in] u4_src_frm_rate
266 * Source frame rate
267 *
268 * @param[in] u4_tgt_frm_rate
269 * Target frame rate
270 *
271 * @returns
272 * none
273 *
274 * @remarks
275 *
276 *******************************************************************************
277 */
ih264e_init_frame_time(frame_time_t * ps_frame_time,UWORD32 u4_src_frm_rate,UWORD32 u4_tgt_frm_rate)278 void ih264e_init_frame_time(frame_time_t *ps_frame_time,
279 UWORD32 u4_src_frm_rate,
280 UWORD32 u4_tgt_frm_rate)
281 {
282 /* Initialise the common time base based on which the source and target
283 * frame times increase */
284 WORD32 i4_gcd = gcd(u4_src_frm_rate, u4_tgt_frm_rate);
285
286 /* Avoiding overflow by doing calculations in float */
287 number_t s_src_frm_rate, s_tgt_frm_rate, s_gcd, s_common_time_base, s_numerator;
288
289 SET_VAR_Q(s_src_frm_rate, u4_src_frm_rate, 0);
290 SET_VAR_Q(s_tgt_frm_rate, u4_tgt_frm_rate, 0);
291 SET_VAR_Q(s_gcd, i4_gcd, 0);
292 mult32_var_q(s_src_frm_rate, s_tgt_frm_rate, &s_numerator);
293 div32_var_q(s_numerator, s_gcd, &s_common_time_base);
294 number_t_to_word32(s_common_time_base, &(ps_frame_time->common_time_base));
295
296 /* The source and target increment per vop is initialized */
297 ps_frame_time->u4_src_frm_time_incr = ps_frame_time->common_time_base
298 / u4_src_frm_rate;
299 ps_frame_time->u4_tgt_frm_time_incr = ps_frame_time->common_time_base
300 / u4_tgt_frm_rate;
301
302 /* Initialise the source and target times to 0 (RESET) */
303 ps_frame_time->u4_src_frm_time = 0;
304 ps_frame_time->u4_tgt_frm_time = 0;
305
306 /* Initialize the number of frms not to be skipped to 0 */
307 ps_frame_time->u4_num_frms_dont_skip = 0;
308 }
309
310 /**
311 *******************************************************************************
312 *
313 * @brief
314 * Function to check if frame can be skipped
315 *
316 * @par Description
317 * Based on the source and target frame time and the delta time stamp
318 * we decide whether to code the source or not.
319 * This is based on the assumption
320 * that the source frame rate is greater that target frame rate.
321 * Updates the time_stamp structure
322 *
323 * @param[in] ps_frame_time
324 * Handle to frame time context
325 *
326 * @param[in] u4_delta_time_stamp
327 * Time stamp difference between frames
328 *
329 * @param[out] pu4_frm_not_skipped_for_dts
330 * Flag to indicate if frame is already skipped by application
331 *
332 * @returns
333 * Flag to skip frame
334 *
335 * @remarks
336 *
337 *******************************************************************************
338 */
ih264e_should_src_be_skipped(frame_time_t * ps_frame_time,UWORD32 u4_delta_time_stamp,UWORD32 * pu4_frm_not_skipped_for_dts)339 UWORD8 ih264e_should_src_be_skipped(frame_time_t *ps_frame_time,
340 UWORD32 u4_delta_time_stamp,
341 UWORD32 *pu4_frm_not_skipped_for_dts)
342 {
343 UWORD8 skip_src = 0;
344
345 if (ps_frame_time->u4_tgt_frm_time > ps_frame_time->u4_src_frm_time &&
346 ps_frame_time->u4_tgt_frm_time >= (ps_frame_time->u4_src_frm_time +
347 ps_frame_time->u4_src_frm_time_incr))
348 {
349 skip_src = 1;
350 }
351
352 /* source time gets updated every frame */
353 ps_frame_time->u4_src_frm_time += ps_frame_time->u4_src_frm_time_incr;
354
355 /* target time gets updated only when the source is coded */
356 if (!skip_src)
357 {
358 ps_frame_time->u4_tgt_frm_time += ps_frame_time->u4_tgt_frm_time_incr;
359 }
360
361 /* If the source and target frame times get incremented properly
362 both should be equal to the common time base at the same time. If
363 that happens we reset the time to zero*/
364 if (( ps_frame_time->common_time_base ==(WORD32)ps_frame_time->u4_src_frm_time)
365 && (ps_frame_time->common_time_base ==(WORD32) ps_frame_time->u4_tgt_frm_time ))
366 {
367 ps_frame_time->u4_src_frm_time = 0;
368 ps_frame_time->u4_tgt_frm_time = 0;
369 }
370
371 /* This keeps a count of how many frames need not be skipped in order
372 to take care of the delta time stamp */
373 ps_frame_time->u4_num_frms_dont_skip += (u4_delta_time_stamp - 1);
374
375 /** If this frame is to be skipped in order to maintain the tgt_frm_rate
376 check if already a frame has been skipped by the application.
377 In that case, do not skip this frame **/
378 if (ps_frame_time->u4_num_frms_dont_skip && skip_src)
379 {
380 skip_src = 0;
381 *pu4_frm_not_skipped_for_dts = 1;
382 ps_frame_time->u4_num_frms_dont_skip -= 1;
383 }
384 else
385 {
386 pu4_frm_not_skipped_for_dts[0] = 0;
387 }
388
389 return (skip_src);
390 }
391
392 /**
393 *******************************************************************************
394 *
395 * @brief
396 * Function to inititialize time stamp memtabs
397 *
398 * @par Description
399 * Function to initialize time stamp memtabs
400 *
401 * @param[in] pps_time_stamp
402 * Pointer to time stamp context
403 *
404 * @param[in] ps_memtab
405 * Pointer to memtab
406 *
407 * @param[in] e_func_type
408 * Funcion type (Get memtab/ init memtab)
409 *
410 * @returns
411 * number of memtabs used
412 *
413 * @remarks
414 *
415 *******************************************************************************
416 */
ih264e_time_stamp_get_init_free_memtab(time_stamp_handle * pps_time_stamp,itt_memtab_t * ps_memtab,ITT_FUNC_TYPE_E e_func_type)417 WORD32 ih264e_time_stamp_get_init_free_memtab(time_stamp_handle *pps_time_stamp,
418 itt_memtab_t *ps_memtab,
419 ITT_FUNC_TYPE_E e_func_type)
420 {
421 WORD32 i4_mem_tab_idx = 0;
422 time_stamp_t s_temp_time_stamp_t;
423
424 /* Hack for al alloc, during which we dont have any state memory.
425 Dereferencing can cause issues */
426 if (e_func_type == GET_NUM_MEMTAB || e_func_type == FILL_MEMTAB)
427 (*pps_time_stamp) = &s_temp_time_stamp_t;
428
429 /* for src rate control state structure */
430 if (e_func_type != GET_NUM_MEMTAB)
431 {
432 fill_memtab(&ps_memtab[i4_mem_tab_idx], sizeof(time_stamp_t),
433 ALIGN_128_BYTE, PERSISTENT, DDR);
434 use_or_fill_base(&ps_memtab[0], (void**) pps_time_stamp, e_func_type);
435 }
436 i4_mem_tab_idx++;
437
438 return (i4_mem_tab_idx);
439 }
440
441 /**
442 *******************************************************************************
443 *
444 * @brief
445 * Function to initialize time stamp context
446 *
447 * @par Description
448 * Time stamp structure stores the time stamp data that
449 * needs to be sent in to the header of MPEG4. Based on the
450 * max target frame rate the vop_time increment resolution is set
451 * so as to support all the frame rates below max frame rate.
452 * A support till the third decimal point is assumed.
453 *
454 * @param[in] ps_time_stamp
455 * Pointer to time stamp structure
456 *
457 * @param[in] u4_max_frm_rate
458 * Maximum frame rate
459 *
460 * @param[in] u4_src_frm_rate
461 * Source frame rate
462 *
463 * @returns
464 * none
465 *
466 * @remarks
467 *
468 *******************************************************************************
469 */
ih264e_init_time_stamp(time_stamp_t * ps_time_stamp,UWORD32 u4_max_frm_rate,UWORD32 u4_src_frm_rate)470 void ih264e_init_time_stamp(time_stamp_t *ps_time_stamp,
471 UWORD32 u4_max_frm_rate,
472 UWORD32 u4_src_frm_rate)
473 {
474 /* We expect the max frame rate to be less than 60000,
475 * if not we divide it by zero and work with it */
476 if (u4_max_frm_rate > 60000)
477 {
478 u4_max_frm_rate >>= 1;
479 ps_time_stamp->is_max_frame_rate_scaled = 1;
480 }
481 else
482 {
483 ps_time_stamp->is_max_frame_rate_scaled = 0;
484 }
485
486 ps_time_stamp->u4_vop_time_incr_res = u4_max_frm_rate;
487 ps_time_stamp->u4_vop_time_incr_range = ih264e_get_range(u4_max_frm_rate, 32);
488 ps_time_stamp->u4_vop_time_incr = (ps_time_stamp->u4_vop_time_incr_res * 1000) / u4_src_frm_rate;/* Since frm rate is in millisec */
489 ps_time_stamp->u4_vop_time = 0;
490 ps_time_stamp->u4_cur_tgt_vop_time = 0;
491 ps_time_stamp->u4_prev_tgt_vop_time = 0;
492 }
493
494 /**
495 *******************************************************************************
496 *
497 * @brief Function to update time stamp context
498 *
499 * @par Description
500 * Vop time is incremented by increment value. When vop time goes
501 * more than the vop time resolution set the modulo time base to
502 * 1 and reduce the vop time by vop time resolution so that the
503 * excess value is present in vop time and get accumulated over time
504 * so that the corresponding frame rate is achieved at a average of
505 * 1000 seconds
506 *
507 * @param[in] ps_time_stamp
508 * Pointer to time stamp structure
509 *
510 * @returns
511 * none
512 *
513 * @remarks
514 *
515 *******************************************************************************
516 */
ih264e_update_time_stamp(time_stamp_t * ps_time_stamp)517 void ih264e_update_time_stamp(time_stamp_t *ps_time_stamp)
518 {
519 /* Since get time stamp is called after the update
520 A copy of the vop time and the modulo time is stored */
521 ps_time_stamp->u4_cur_tgt_vop_time = ps_time_stamp->u4_vop_time;
522
523 ps_time_stamp->u4_vop_time += ps_time_stamp->u4_vop_time_incr;
524 if (ps_time_stamp->u4_vop_time >= ps_time_stamp->u4_vop_time_incr_res)
525 {
526 ps_time_stamp->u4_vop_time -= ps_time_stamp->u4_vop_time_incr_res;
527 }
528 }
529
530 /****************************************************************************
531 Run-Time Modifying functions
532 ****************************************************************************/
533
534 /**
535 *******************************************************************************
536 *
537 * @brief Function to get source frame rate
538 *
539 * @par Description
540 * Function to get source frame rate
541 *
542 * @param[in] ps_frame_time
543 * Pointer to frame time context
544 *
545 * @returns
546 * source frame rate
547 *
548 * @remarks
549 *
550 *******************************************************************************
551 */
ih264e_frame_time_get_src_frame_rate(frame_time_t * ps_frame_time)552 WORD32 ih264e_frame_time_get_src_frame_rate(frame_time_t *ps_frame_time)
553 {
554 return (ps_frame_time->common_time_base / ps_frame_time->u4_src_frm_time_incr);
555 }
556
557 /**
558 *******************************************************************************
559 *
560 * @brief Function to get target frame rate
561 *
562 * @par Description
563 * Function to get target frame rate
564 *
565 * @param[in] ps_frame_time
566 * Pointer to frame time context
567 *
568 * @returns
569 * target frame rate
570 *
571 * @remarks
572 *
573 *******************************************************************************
574 */
ih264e_frame_time_get_tgt_frame_rate(frame_time_t * ps_frame_time)575 WORD32 ih264e_frame_time_get_tgt_frame_rate(frame_time_t *ps_frame_time)
576 {
577 return (ps_frame_time->common_time_base / ps_frame_time->u4_tgt_frm_time_incr);
578 }
579
580 /**
581 *******************************************************************************
582 *
583 * @brief Function to get source time increment
584 *
585 * @par Description
586 * Function to get source time increment
587 *
588 * @param[in] ps_frame_time
589 * Pointer to frame time context
590 *
591 * @returns
592 * source time increment
593 *
594 * @remarks
595 *
596 *******************************************************************************
597 */
ih264e_frame_time_get_src_ticks(frame_time_t * ps_frame_time)598 WORD32 ih264e_frame_time_get_src_ticks(frame_time_t *ps_frame_time)
599 {
600 return (ps_frame_time->u4_src_frm_time_incr);
601 }
602
603 /**
604 *******************************************************************************
605 *
606 * @brief Function to get target time increment
607 *
608 * @par Description
609 * Function to get target time increment
610 *
611 * @param[in] ps_frame_time
612 * Pointer to frame time context
613 *
614 * @returns
615 * target time increment
616 *
617 * @remarks
618 *
619 *******************************************************************************
620 */
ih264e_frame_time_get_tgt_ticks(frame_time_t * ps_frame_time)621 WORD32 ih264e_frame_time_get_tgt_ticks(frame_time_t *ps_frame_time)
622 {
623 return (ps_frame_time->u4_tgt_frm_time_incr);
624 }
625
626 /**
627 *******************************************************************************
628 *
629 * @brief Function to get src frame time
630 *
631 * @par Description
632 * Function to get src frame time
633 *
634 * @param[in] ps_frame_time
635 * Pointer to frame time context
636 *
637 * @returns
638 * src frame time
639 *
640 * @remarks
641 *
642 *******************************************************************************
643 */
ih264e_frame_time_get_src_time(frame_time_t * frame_time)644 WORD32 ih264e_frame_time_get_src_time(frame_time_t *frame_time)
645 {
646 return (frame_time->u4_src_frm_time);
647 }
648
649 /**
650 *******************************************************************************
651 *
652 * @brief Function to get tgt frame time
653 *
654 * @par Description
655 * Function to get tgt frame time
656 *
657 * @param[in] ps_frame_time
658 * Pointer to frame time context
659 *
660 * @returns
661 * tgt frame time
662 *
663 * @remarks
664 *
665 *******************************************************************************
666 */
ih264e_frame_time_get_tgt_time(frame_time_t * frame_time)667 WORD32 ih264e_frame_time_get_tgt_time(frame_time_t *frame_time)
668 {
669 return (frame_time->u4_tgt_frm_time);
670 }
671
672 /**
673 *******************************************************************************
674 *
675 * @brief Function to update source frame time with a new source frame rate
676 *
677 * @par Description
678 * Function to update source frame time with a new source frame rate
679 *
680 * @param[in] ps_frame_time
681 * Pointer to frame time context
682 *
683 * @param[in] src_frm_rate
684 * source frame rate
685 *
686 * @returns
687 * none
688 *
689 * @remarks
690 *
691 *******************************************************************************
692 */
ih264e_frame_time_update_src_frame_rate(frame_time_t * ps_frame_time,WORD32 src_frm_rate)693 void ih264e_frame_time_update_src_frame_rate(frame_time_t *ps_frame_time,
694 WORD32 src_frm_rate)
695 {
696 /* Since tgt frame rate does not change deriving the tgt_frm rate from
697 * common_time_base */
698 WORD32 tgt_frm_rate = ps_frame_time->common_time_base / ps_frame_time->u4_tgt_frm_time_incr;
699
700 /* Re-initialise frame_time based on the new src_frame_rate and
701 * old tgt_frame_rate */
702 ih264e_init_frame_time(ps_frame_time, src_frm_rate, tgt_frm_rate);
703 }
704
705 /**
706 *******************************************************************************
707 *
708 * @brief Function to update target frame time with a new source frame rate
709 *
710 * @par Description
711 * Function to update target frame time with a new source frame rate
712 *
713 * @param[in] ps_frame_time
714 * Pointer to frame time context
715 *
716 * @param[in] tgt_frm_rate
717 * target frame rate
718 *
719 * @returns
720 * none
721 *
722 * @remarks
723 *
724 *******************************************************************************
725 */
ih264e_frame_time_update_tgt_frame_rate(frame_time_t * ps_frame_time,WORD32 tgt_frm_rate)726 void ih264e_frame_time_update_tgt_frame_rate(frame_time_t *ps_frame_time,
727 WORD32 tgt_frm_rate)
728 {
729 /* Since src frame rate does not change deriving the src_frm rate from
730 * common_time_base */
731 WORD32 src_frm_rate = ps_frame_time->common_time_base / ps_frame_time->u4_src_frm_time_incr;
732
733 /* Re-initialise frame_time based on the new tgt_frame_rate and
734 * old src_frame_rate */
735 ih264e_init_frame_time(ps_frame_time, src_frm_rate, tgt_frm_rate);
736 }
737
738 /**
739 *******************************************************************************
740 *
741 * @brief Function to update target frame time with a new source frame rate
742 *
743 * @par Description
744 * When the frame rate changes the time increment is modified by appropriate ticks
745 *
746 * @param[in] ps_time_stamp
747 * Pointer to time stamp structure
748 *
749 * @param[in] src_frm_rate
750 * source frame rate
751 *
752 * @returns
753 * none
754 *
755 * @remarks
756 *
757 *******************************************************************************
758 */
ih264_time_stamp_update_frame_rate(time_stamp_t * ps_time_stamp,UWORD32 src_frm_rate)759 void ih264_time_stamp_update_frame_rate(time_stamp_t *ps_time_stamp,
760 UWORD32 src_frm_rate)
761 {
762 ps_time_stamp->u4_vop_time_incr = (ps_time_stamp->u4_vop_time_incr_res * 1000) / src_frm_rate;/* Since frm rate is in millisec */
763 }
764