forked from Grouper-AOSP/platform_manifest
/
external_libmpeg2.patch
994 lines (853 loc) · 37.3 KB
/
external_libmpeg2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
diff --git a/common/arm/ideint_cac_a9.s b/common/arm/ideint_cac_a9.s
index 964c5e6..9de9752 100644
--- a/common/arm/ideint_cac_a9.s
+++ b/common/arm/ideint_cac_a9.s
@@ -66,6 +66,7 @@
ideint_cac_8x8_a9:
stmfd sp!, {r4-r10, lr}
+ vpush {d9}
@ Load first row of top
vld1.u8 d28, [r0], r2
@@ -210,4 +211,5 @@ ideint_cac_8x8_a9:
vmov.u32 r0, d0[0]
cmp r0, #0
movne r0, #1
+ vpop {d9}
ldmfd sp!, {r4-r10, pc}
diff --git a/common/arm/impeg2_idct.s b/common/arm/impeg2_idct.s
index 0b83b72..2f29f43 100644
--- a/common/arm/impeg2_idct.s
+++ b/common/arm/impeg2_idct.s
@@ -108,6 +108,7 @@ gai2_impeg2_idct_first_col_q11_addr2:
.global impeg2_idct_recon_dc_a9q
impeg2_idct_recon_dc_a9q:
stmfd sp!, {r4, r6, r12, lr}
+ vpush {d8-d15}
@//r0: pi2_src
@//r1: pi2_tmp - not used, used as pred_strd
@//r2: pu1_pred
@@ -115,8 +116,8 @@ impeg2_idct_recon_dc_a9q:
@//r4: used as scratch
@//r5:
- ldr r1, [sp, #20] @//pred_strd
- ldr r6, [sp, #24] @//dst_strd
+ ldr r1, [sp, #84] @//pred_strd
+ ldr r6, [sp, #88] @//dst_strd
ldr r14, gai2_impeg2_idct_q15_addr1
q15lbl1:
@@ -188,6 +189,7 @@ q11lbl1:
vst1.8 d7, [r3], r6
+ vpop {d8-d15}
ldmfd sp!, {r4, r6, r12, pc}
@@ -196,9 +198,10 @@ q11lbl1:
.global impeg2_idct_recon_dc_mismatch_a9q
impeg2_idct_recon_dc_mismatch_a9q:
stmfd sp!, {r4-r12, lr}
+ vpush {d8-d15}
- ldr r1, [sp, #44] @//pred_strd
- ldr r6, [sp, #48] @//dst_strd
+ ldr r1, [sp, #108] @//pred_strd
+ ldr r6, [sp, #112] @//dst_strd
ldr r14, gai2_impeg2_idct_q15_addr2
q15lbl2:
@@ -304,6 +307,7 @@ additive_lbl:
vst1.8 d30, [r3], r6
+ vpop {d8-d15}
ldmfd sp!, {r4-r12, pc}
@@ -406,12 +410,14 @@ impeg2_idct_recon_a9q:
@// Copy the input pointer to another register
@// Step 1 : load all constants
stmfd sp!, {r4-r12, lr}
+ vpush {d8-d15}
+
+ ldr r8, [sp, #108] @ prediction stride
+ ldr r7, [sp, #112] @ destination stride
+ ldr r6, [sp, #104] @ src stride
+ ldr r12, [sp, #116]
+ ldr r11, [sp, #120]
- ldr r8, [sp, #44] @ prediction stride
- ldr r7, [sp, #48] @ destination stride
- ldr r6, [sp, #40] @ src stride
- ldr r12, [sp, #52]
- ldr r11, [sp, #56]
mov r6, r6, lsl #1 @ x sizeof(word16)
add r9, r0, r6, lsl #1 @ 2 rows
@@ -1198,6 +1204,7 @@ pred_buff_addition:
+ vpop {d8-d15}
ldmfd sp!, {r4-r12, pc}
diff --git a/common/arm/impeg2_inter_pred.s b/common/arm/impeg2_inter_pred.s
index f1b3dde..23beca1 100644
--- a/common/arm/impeg2_inter_pred.s
+++ b/common/arm/impeg2_inter_pred.s
@@ -100,7 +100,7 @@
impeg2_copy_mb_a9q:
- stmfd r13!, {r4, r5, r14}
+ stmfd sp!, {r4, r5, r14}
ldr r4, [r0] @src->y
@@ -188,7 +188,7 @@ impeg2_copy_mb_a9q:
vld1.8 {d0}, [r4], r2 @Load and increment src
vst1.8 {d0}, [r5], r3 @Store and increment dst
- ldmfd r13!, {r4, r5, pc}
+ ldmfd sp!, {r4, r5, pc}
@@ -223,7 +223,8 @@ impeg2_copy_mb_a9q:
impeg2_mc_fullx_halfy_8x8_a9q:
- stmfd r13!, {r14}
+ stmfd sp!, {r14}
+ vpush {d8-d9}
add r14, r1, r2
mov r2, r2, lsl #1
@@ -257,6 +258,7 @@ impeg2_mc_fullx_halfy_8x8_a9q:
vst1.8 {d7}, [r14], r3 @// eighth row hence r8 = D7
vst1.8 {d5}, [r0], r3 @// seventh row hence r7 = D5
+ vpop {d8-d9}
ldmfd sp!, {pc}
@@ -315,27 +317,27 @@ impeg2_mc_halfx_fully_8x8_a9q:
vld1.8 {d6, d7}, [r14], r2 @row6
- vext.8 d8, d0, d1, #1 @Extract pixels (1-8) of row1
+ vext.8 d24, d0, d1, #1 @Extract pixels (1-8) of row1
- vext.8 d12, d2, d3, #1 @Extract pixels (1-8) of row5
+ vext.8 d28, d2, d3, #1 @Extract pixels (1-8) of row5
vext.8 d16, d4, d5, #1 @Extract pixels (1-8) of row2
vext.8 d20, d6, d7, #1 @Extract pixels (1-8) of row6
- vld1.8 {d9, d10}, [r1], r2 @load row3
+ vld1.8 {d25, d26}, [r1], r2 @load row3
- vld1.8 {d13, d14}, [r14], r2 @load row7
+ vld1.8 {d29, d30}, [r14], r2 @load row7
vld1.8 {d17, d18}, [r1], r2 @load row4
vld1.8 {d21, d22}, [r14], r2 @load row8
- vext.8 d1, d9, d10, #1 @Extract pixels (1-8) of row3
+ vext.8 d1, d25, d26, #1 @Extract pixels (1-8) of row3
- vext.8 d3, d13, d14, #1 @Extract pixels (1-8) of row7
+ vext.8 d3, d29, d30, #1 @Extract pixels (1-8) of row7
@@ -344,9 +346,9 @@ impeg2_mc_halfx_fully_8x8_a9q:
vext.8 d7, d21, d22, #1 @Extract pixels (1-8) of row8
- vrhadd.u8 q0, q0, q4 @operate on row1 and row3
+ vrhadd.u8 q0, q0, q12 @operate on row1 and row3
- vrhadd.u8 q1, q1, q6 @operate on row5 and row7
+ vrhadd.u8 q1, q1, q14 @operate on row5 and row7
vrhadd.u8 q2, q2, q8 @operate on row2 and row4
@@ -415,6 +417,7 @@ impeg2_mc_halfx_fully_8x8_a9q:
impeg2_mc_halfx_halfy_8x8_a9q:
stmfd sp!, {r14}
+ vpush {d8-d15}
add r14, r1, r2, lsl #2
@@ -548,6 +551,7 @@ impeg2_mc_halfx_halfy_8x8_a9q:
+ vpop {d8-d15}
ldmfd sp!, {pc}
@@ -663,7 +667,8 @@ impeg2_mc_fullx_fully_8x8_a9q:
impeg2_interpolate_a9q:
- stmfd r13!, {r4, r5, r7, r12, r14}
+ stmfd sp!, {r4, r5, r7, r12, r14}
+ vpush {d8-d15}
ldr r4, [r0, #0] @ptr_y src1
@@ -793,7 +798,8 @@ interp_chromablocks_stride:
bne interp_chromablocks_stride
- ldmfd r13!, {r4, r5, r7, r12, pc}
+ vpop {d8-d15}
+ ldmfd sp!, {r4, r5, r7, r12, pc}
diff --git a/common/arm/impeg2_mem_func.s b/common/arm/impeg2_mem_func.s
index 869b7d7..ea34db4 100644
--- a/common/arm/impeg2_mem_func.s
+++ b/common/arm/impeg2_mem_func.s
@@ -146,7 +146,7 @@ impeg2_memset_8bit_8x8_block_a9q:
impeg2_memset0_16bit_8x8_linear_block_a9q:
- stmfd r13!, {r14}
+ stmfd sp!, {r14}
vmov.i16 q0, #0
@@ -170,7 +170,7 @@ impeg2_memset0_16bit_8x8_linear_block_a9q:
- ldmfd r13!, {pc}
+ ldmfd sp!, {pc}
diff --git a/decoder/impeg2d_api_main.c b/decoder/impeg2d_api_main.c
index c0813c4..847c4f7 100644
--- a/decoder/impeg2d_api_main.c
+++ b/decoder/impeg2d_api_main.c
@@ -125,6 +125,7 @@
void impeg2d_init_arch(void *pv_codec);
void impeg2d_init_function_ptr(void *pv_codec);
+UWORD32 impeg2d_get_outbuf_size(WORD32 pic_wd,UWORD32 pic_ht, WORD32 u1_chroma_format,UWORD32 *p_buf_size);
/*****************************************************************************/
/* */
@@ -211,6 +212,8 @@ IV_API_CALL_STATUS_T impeg2d_api_set_display_frame(iv_obj_t *ps_dechdl,
dec_state_t *ps_dec_state;
dec_state_multi_core_t *ps_dec_state_multi_core;
UWORD32 u4_num_disp_bufs;
+ UWORD32 u4_disp_buf_size[3];
+ UWORD32 num_bufs;
dec_disp_ip = (ivd_set_display_frame_ip_t *)pv_api_ip;
@@ -224,12 +227,41 @@ IV_API_CALL_STATUS_T impeg2d_api_set_display_frame(iv_obj_t *ps_dechdl,
ps_dec_state_multi_core = (dec_state_multi_core_t *) (ps_dechdl->pv_codec_handle);
ps_dec_state = ps_dec_state_multi_core->ps_dec_state[0];
+ num_bufs = dec_disp_ip->s_disp_buffer[0].u4_num_bufs;
+
if(ps_dec_state->u4_share_disp_buf)
{
pic_buf_t *ps_pic_buf;
ps_pic_buf = (pic_buf_t *)ps_dec_state->pv_pic_buf_base;
+
+ /* Get the sizes of the first buffer structure. Compare this with the
+ * rest to make sure all the buffers are of the same size.
+ */
+ u4_disp_buf_size[0] =
+ dec_disp_ip->s_disp_buffer[0].u4_min_out_buf_size[0];
+ u4_disp_buf_size[1] =
+ dec_disp_ip->s_disp_buffer[0].u4_min_out_buf_size[1];
+ u4_disp_buf_size[2] =
+ dec_disp_ip->s_disp_buffer[0].u4_min_out_buf_size[2];
for(i = 0; i < u4_num_disp_bufs; i++)
{
+ /* Verify all buffer structures have the same sized buffers as the
+ * first buffer structure*/
+ if ((dec_disp_ip->s_disp_buffer[i].u4_min_out_buf_size[0]
+ != u4_disp_buf_size[0])
+ || (dec_disp_ip->s_disp_buffer[i].u4_min_out_buf_size[1]
+ != u4_disp_buf_size[1])
+ || (dec_disp_ip->s_disp_buffer[i].u4_min_out_buf_size[2]
+ != u4_disp_buf_size[2]))
+ {
+ return IV_FAIL;
+ }
+ /* Verify all buffer structures have the same number of
+ * buffers (e.g. y, u, v) */
+ if (dec_disp_ip->s_disp_buffer[i].u4_num_bufs != num_bufs)
+ {
+ return IV_FAIL;
+ }
ps_pic_buf->pu1_y = dec_disp_ip->s_disp_buffer[i].pu1_bufs[0];
if(IV_YUV_420P == ps_dec_state->i4_chromaFormat)
@@ -428,7 +460,11 @@ void impeg2d_fill_mem_rec(impeg2d_fill_mem_rec_ip_t *ps_ip,
UWORD32 u4_deinterlace;
UNUSED(u4_deinterlace);
max_frm_width = ALIGN16(ps_ip->s_ivd_fill_mem_rec_ip_t.u4_max_frm_wd);
- max_frm_height = ALIGN16(ps_ip->s_ivd_fill_mem_rec_ip_t.u4_max_frm_ht);
+ /* In error clips with field prediction, the mv may incorrectly refer to
+ * the last MB row, causing an out of bounds read access. Allocating 8 extra
+ * rows to handle this. Adding another extra row to handle half_y prediction.
+ */
+ max_frm_height = ALIGN32(ps_ip->s_ivd_fill_mem_rec_ip_t.u4_max_frm_ht) + 9;
max_frm_size = (max_frm_width * max_frm_height * 3) >> 1;/* 420 P */
@@ -760,35 +796,6 @@ IV_API_CALL_STATUS_T impeg2d_api_get_buf_info(iv_obj_t *ps_dechdl,
ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_num_in_bufs = 1;
ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_num_out_bufs = 1;
- if(ps_dec_state->i4_chromaFormat == IV_YUV_420P)
- {
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_num_out_bufs =
- MIN_OUT_BUFS_420;
- }
- else if((ps_dec_state->i4_chromaFormat == IV_YUV_420SP_UV)
- || (ps_dec_state->i4_chromaFormat == IV_YUV_420SP_VU))
- {
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_num_out_bufs =
- MIN_OUT_BUFS_420SP;
- }
- else if(ps_dec_state->i4_chromaFormat == IV_YUV_422ILE)
- {
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_num_out_bufs =
- MIN_OUT_BUFS_422ILE;
- }
- else if(ps_dec_state->i4_chromaFormat == IV_RGB_565)
- {
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_num_out_bufs =
- MIN_OUT_BUFS_RGB565;
- }
- else
- {
- //Invalid chroma format; Error code may be updated, verify in testing if needed
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_error_code =
- IVD_INIT_DEC_COL_FMT_NOT_SUPPORTED;
- return IV_FAIL;
- }
-
for(u4_i = 0; u4_i < IVD_VIDDEC_MAX_IO_BUFFERS; u4_i++)
{
ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_in_buf_size[u4_i] =
@@ -820,33 +827,22 @@ IV_API_CALL_STATUS_T impeg2d_api_get_buf_info(iv_obj_t *ps_dechdl,
{
u4_stride = ps_dec_state->u4_frm_buf_stride;
}
- u4_height = ((ps_dec_state->u2_frame_height + 15) >> 4) << 4;
+ u4_stride = ALIGN16(u4_stride);
+ u4_height = ALIGN32(ps_dec_state->u2_frame_height) + 9;
- if(ps_dec_state->i4_chromaFormat == IV_YUV_420P)
- {
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_out_buf_size[0] =
- (u4_stride * u4_height);
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_out_buf_size[1] =
- (u4_stride * u4_height) >> 2;
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_out_buf_size[2] =
- (u4_stride * u4_height) >> 2;
- }
- else if((ps_dec_state->i4_chromaFormat == IV_YUV_420SP_UV)
- || (ps_dec_state->i4_chromaFormat == IV_YUV_420SP_VU))
- {
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_out_buf_size[0] =
- (u4_stride * u4_height);
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_out_buf_size[1] =
- (u4_stride * u4_height) >> 1;
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_out_buf_size[2] = 0;
- }
- else if(ps_dec_state->i4_chromaFormat == IV_YUV_422ILE)
+ ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_num_out_bufs =
+ impeg2d_get_outbuf_size(
+ u4_stride,
+ u4_height,
+ ps_dec_state->i4_chromaFormat,
+ &ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_out_buf_size[0]);
+
+ if (0 == ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_num_out_bufs)
{
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_out_buf_size[0] =
- (u4_stride * u4_height) * 2;
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_out_buf_size[1] =
- ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_min_out_buf_size[2] =
- 0;
+ //Invalid chroma format; Error code may be updated, verify in testing if needed
+ ps_ctl_bufinfo_op->s_ivd_ctl_getbufinfo_op_t.u4_error_code =
+ IVD_INIT_DEC_COL_FMT_NOT_SUPPORTED;
+ return IV_FAIL;
}
/* Adding initialization for 2 uninitialized values */
@@ -1022,6 +1018,7 @@ IV_API_CALL_STATUS_T impeg2d_api_reset(iv_obj_t *ps_dechdl,
ps_dec_state->u2_header_done = 0; /* Header decoding not done */
ps_dec_state->u4_frm_buf_stride = 0;
+ ps_dec_state->i4_pic_count = 0;
ps_dec_state->u2_is_mpeg2 = 0;
ps_dec_state->aps_ref_pics[0] = NULL;
ps_dec_state->aps_ref_pics[1] = NULL;
@@ -1508,6 +1505,100 @@ IV_API_CALL_STATUS_T impeg2d_api_fill_mem_rec(void *pv_api_ip,void *pv_api_op)
}
+UWORD32 impeg2d_get_outbuf_size(WORD32 pic_wd,UWORD32 pic_ht, WORD32 u1_chroma_format,UWORD32 *p_buf_size)
+{
+ UWORD32 u4_min_num_out_bufs = 0;
+ if(u1_chroma_format == IV_YUV_420P)
+ u4_min_num_out_bufs = MIN_OUT_BUFS_420;
+ else if(u1_chroma_format == IV_YUV_422ILE)
+ u4_min_num_out_bufs = MIN_OUT_BUFS_422ILE;
+ else if(u1_chroma_format == IV_RGB_565)
+ u4_min_num_out_bufs = MIN_OUT_BUFS_RGB565;
+ else if((u1_chroma_format == IV_YUV_420SP_UV)
+ || (u1_chroma_format == IV_YUV_420SP_VU))
+ u4_min_num_out_bufs = MIN_OUT_BUFS_420SP;
+
+ if(u1_chroma_format == IV_YUV_420P)
+ {
+ p_buf_size[0] = (pic_wd * pic_ht);
+ p_buf_size[1] = (pic_wd * pic_ht)
+ >> 2;
+ p_buf_size[2] = (pic_wd * pic_ht)
+ >> 2;
+ }
+ else if(u1_chroma_format == IV_YUV_422ILE)
+ {
+ p_buf_size[0] = (pic_wd * pic_ht)
+ * 2;
+ p_buf_size[1] =
+ p_buf_size[2] = 0;
+ }
+ else if(u1_chroma_format == IV_RGB_565)
+ {
+ p_buf_size[0] = (pic_wd * pic_ht)
+ * 2;
+ p_buf_size[1] =
+ p_buf_size[2] = 0;
+ }
+ else if((u1_chroma_format == IV_YUV_420SP_UV)
+ || (u1_chroma_format == IV_YUV_420SP_VU))
+ {
+ p_buf_size[0] = (pic_wd * pic_ht);
+ p_buf_size[1] = (pic_wd * pic_ht)
+ >> 1;
+ p_buf_size[2] = 0;
+ }
+
+ return u4_min_num_out_bufs;
+}
+
+WORD32 check_app_out_buf_size(dec_state_t *ps_dec)
+{
+ UWORD32 au4_min_out_buf_size[IVD_VIDDEC_MAX_IO_BUFFERS];
+ UWORD32 u4_min_num_out_bufs, i;
+ UWORD32 pic_wd, pic_ht;
+
+ pic_wd = ps_dec->u2_horizontal_size;
+ pic_ht = ps_dec->u2_vertical_size;
+
+ if(ps_dec->u4_frm_buf_stride > pic_wd)
+ pic_wd = ps_dec->u4_frm_buf_stride;
+
+ u4_min_num_out_bufs = impeg2d_get_outbuf_size(pic_wd, pic_ht, ps_dec->i4_chromaFormat, &au4_min_out_buf_size[0]);
+
+ if (0 == ps_dec->u4_share_disp_buf)
+ {
+ if(ps_dec->ps_out_buf->u4_num_bufs < u4_min_num_out_bufs)
+ {
+ return IV_FAIL;
+ }
+
+ for (i = 0 ; i < u4_min_num_out_bufs; i++)
+ {
+ if(ps_dec->ps_out_buf->u4_min_out_buf_size[i] < au4_min_out_buf_size[i])
+ return (IV_FAIL);
+ }
+ }
+ else
+ {
+ if(ps_dec->as_disp_buffers[0].u4_num_bufs < u4_min_num_out_bufs)
+ return IV_FAIL;
+
+ for (i = 0 ; i < u4_min_num_out_bufs; i++)
+ {
+ /* We need to check only with the disp_buffer[0], because we have
+ * already ensured that all the buffers are of the same size in
+ * impeg2d_api_set_display_frame.
+ */
+ if(ps_dec->as_disp_buffers[0].u4_min_out_buf_size[i] <
+ au4_min_out_buf_size[i])
+ return (IV_FAIL);
+ }
+ }
+
+ return(IV_SUCCESS);
+}
+
/*****************************************************************************/
@@ -1791,7 +1882,6 @@ IV_API_CALL_STATUS_T impeg2d_api_init(iv_obj_t *ps_dechdl,
}
}
-
ps_dec_state = ps_dec_state_multi_core->ps_dec_state[0];
if((ps_dec_state->i4_chromaFormat == IV_YUV_422ILE)
@@ -3373,6 +3463,13 @@ IV_API_CALL_STATUS_T impeg2d_api_entity(iv_obj_t *ps_dechdl,
{
ps_dec_state->u1_flushcnt = 0;
+ ps_dec_state->ps_out_buf = &ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer;
+ if (IV_SUCCESS != check_app_out_buf_size(ps_dec_state))
+ {
+ ps_dec_op->s_ivd_video_decode_op_t.u4_error_code = IVD_DISP_FRM_ZERO_OP_BUF_SIZE;
+ return IV_FAIL;
+ }
+
/*************************************************************************/
/* Frame Decode */
/*************************************************************************/
diff --git a/decoder/impeg2d_bitstream.c b/decoder/impeg2d_bitstream.c
index 36092e5..57a9e2f 100644
--- a/decoder/impeg2d_bitstream.c
+++ b/decoder/impeg2d_bitstream.c
@@ -191,21 +191,17 @@ INLINE UWORD8 impeg2d_bit_stream_get_bit(stream_t *ps_stream)
INLINE void impeg2d_bit_stream_flush(void* pv_ctxt, UWORD32 u4_no_of_bits)
{
stream_t *ps_stream = (stream_t *)pv_ctxt;
- if ((ps_stream->u4_offset + 64) < ps_stream->u4_max_offset)
+
+
+ if (ps_stream->u4_offset <= ps_stream->u4_max_offset)
{
+ /* We have to flush the bytes even if the offset is equal to the maximum
+ * offset. This will ensure that a stream with an error exactly at the
+ * offset will not get stuck in an infinite loop - If we do not flush
+ * these bytes, then we keep feeding the erroneous bits.
+ */
FLUSH_BITS(ps_stream->u4_offset,ps_stream->u4_buf,ps_stream->u4_buf_nxt,u4_no_of_bits,ps_stream->pu4_buf_aligned)
}
- else
- {
- UWORD32 u4_temp;
-
- if (((ps_stream->u4_offset & 0x1f) + u4_no_of_bits) >= 32)
- {
- ps_stream->u4_buf = ps_stream->u4_buf_nxt;
- ps_stream->u4_buf_nxt = 0;
- }
- ps_stream->u4_offset += u4_no_of_bits;
- }
return;
}
/******************************************************************************
diff --git a/decoder/impeg2d_dec_hdr.c b/decoder/impeg2d_dec_hdr.c
index 4a84086..f5ebafd 100644
--- a/decoder/impeg2d_dec_hdr.c
+++ b/decoder/impeg2d_dec_hdr.c
@@ -166,14 +166,19 @@ IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_hdr(dec_state_t *ps_dec)
/* This is the first time we are reading the resolution */
ps_dec->u2_horizontal_size = u2_width;
ps_dec->u2_vertical_size = u2_height;
- if (0 == ps_dec->u4_frm_buf_stride)
- {
- ps_dec->u4_frm_buf_stride = (UWORD32) (u2_width);
- }
}
else
{
- if((u2_width > ps_dec->u2_create_max_width)
+ if (0 == ps_dec->i4_pic_count)
+ {
+ /* Decoder has not decoded a single frame since the last
+ * reset/init. This implies that we have two headers in the
+ * input stream. So, do not indicate a resolution change, since
+ * this can take the decoder into an infinite loop.
+ */
+ return (IMPEG2D_ERROR_CODES_T) IMPEG2D_FRM_HDR_DECODE_ERR;
+ }
+ else if((u2_width > ps_dec->u2_create_max_width)
|| (u2_height > ps_dec->u2_create_max_height))
{
IMPEG2D_ERROR_CODES_T e_error = IMPEG2D_UNSUPPORTED_DIMENSIONS;
@@ -183,6 +188,11 @@ IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_hdr(dec_state_t *ps_dec)
return e_error;
}
+ else if((ps_dec->u2_horizontal_size < MIN_WIDTH)
+ || (ps_dec->u2_vertical_size < MIN_HEIGHT))
+ {
+ return IMPEG2D_UNSUPPORTED_DIMENSIONS;
+ }
else
{
/* The resolution has changed */
@@ -200,6 +210,11 @@ IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_hdr(dec_state_t *ps_dec)
return e_error;
}
+ if((ps_dec->u2_horizontal_size < MIN_WIDTH)
+ || (ps_dec->u2_vertical_size < MIN_HEIGHT))
+ {
+ return IMPEG2D_UNSUPPORTED_DIMENSIONS;
+ }
/*------------------------------------------------------------------------*/
/* Flush the following as they are not being used */
@@ -280,6 +295,8 @@ IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_hdr(dec_state_t *ps_dec)
IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_ext(dec_state_t *ps_dec)
{
stream_t *ps_stream;
+ UWORD16 horizontal_value;
+ UWORD16 vertical_value;
ps_stream = &ps_dec->s_bit_stream;
@@ -329,11 +346,30 @@ IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_ext(dec_state_t *ps_dec)
if(impeg2d_bit_stream_get(ps_stream,2) != 0x1)
return IMPEG2D_CHROMA_FMT_NOT_SUP;
+ /* Error resilience: store the 2 most significant bit in horizontal and vertical */
+ /* variables.Use it only if adding them to the vertical and horizontal sizes */
+ /* respectively, doesn't exceed the MAX_WD and MAX_HT supported by the application.*/
+
+
/* Read the 2 most significant bits from horizontal_size */
- ps_dec->u2_horizontal_size += (impeg2d_bit_stream_get(ps_stream,2) << 12);
+ horizontal_value = (impeg2d_bit_stream_get(ps_stream,2) << 12);
/* Read the 2 most significant bits from vertical_size */
- ps_dec->u2_vertical_size += (impeg2d_bit_stream_get(ps_stream,2) << 12);
+ vertical_value = (impeg2d_bit_stream_get(ps_stream,2) << 12);
+
+ /* Error resilience: The height and width should not be more than the*/
+ /*max height and width the application can support*/
+ if(ps_dec->u2_create_max_height < (ps_dec->u2_vertical_size + vertical_value))
+ {
+ return (IMPEG2D_ERROR_CODES_T) IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
+ }
+
+ if(ps_dec->u2_create_max_width < (ps_dec->u2_horizontal_size + horizontal_value))
+ {
+ return (IMPEG2D_ERROR_CODES_T) IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
+ }
+ ps_dec->u2_vertical_size += vertical_value;
+ ps_dec->u2_horizontal_size += horizontal_value;
/*-----------------------------------------------------------------------*/
/* Flush the following as they are not used now */
@@ -914,7 +950,7 @@ void impeg2d_dec_pic_data_thread(dec_state_t *ps_dec)
{
pu1_buf = ps_dec->pu1_inp_bits_buf + s_job.i4_bistream_ofst;
impeg2d_bit_stream_init(&(ps_dec->s_bit_stream), pu1_buf,
- (ps_dec->u4_num_inp_bytes - s_job.i4_bistream_ofst) + 8);
+ (ps_dec->u4_num_inp_bytes - s_job.i4_bistream_ofst));
i4_cur_row = s_job.i2_start_mb_y;
ps_dec->i4_start_mb_y = s_job.i2_start_mb_y;
ps_dec->i4_end_mb_y = s_job.i2_end_mb_y;
@@ -956,6 +992,11 @@ void impeg2d_dec_pic_data_thread(dec_state_t *ps_dec)
if ((IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE != e_error)
{
impeg2d_next_start_code(ps_dec);
+ if(ps_dec->s_bit_stream.u4_offset >= ps_dec->s_bit_stream.u4_max_offset)
+ {
+ ps_dec->u4_error_code = IMPEG2D_BITSTREAM_BUFF_EXCEEDED_ERR;
+ return;
+ }
}
}
@@ -975,23 +1016,30 @@ void impeg2d_dec_pic_data_thread(dec_state_t *ps_dec)
if(i4_continue_decode)
{
- /* If the slice is from the same row, then continue decoding without dequeue */
- if((temp - 1) == i4_cur_row)
- {
- i4_dequeue_job = 0;
- break;
- }
-
- if(temp < ps_dec->i4_end_mb_y)
+ if (0 != ps_dec->u2_num_mbs_left)
{
- i4_cur_row = ps_dec->u2_mb_y;
+ /* If the slice is from the same row, then continue decoding without dequeue */
+ if((temp - 1) == i4_cur_row)
+ {
+ i4_dequeue_job = 0;
+ }
+ else
+ {
+ if(temp < ps_dec->i4_end_mb_y)
+ {
+ i4_cur_row = ps_dec->u2_mb_y;
+ }
+ else
+ {
+ i4_dequeue_job = 1;
+ }
+ }
}
else
{
i4_dequeue_job = 1;
}
break;
-
}
else
break;
@@ -1068,6 +1116,7 @@ static WORD32 impeg2d_init_thread_dec_ctxt(dec_state_t *ps_dec,
ps_dec_thd->u2_mb_x = 0;
ps_dec_thd->u2_mb_y = 0;
ps_dec_thd->u2_is_mpeg2 = ps_dec->u2_is_mpeg2;
+ ps_dec_thd->i4_pic_count = ps_dec->i4_pic_count;
ps_dec_thd->u2_frame_width = ps_dec->u2_frame_width;
ps_dec_thd->u2_frame_height = ps_dec->u2_frame_height;
ps_dec_thd->u2_picture_width = ps_dec->u2_picture_width;
@@ -1337,8 +1386,6 @@ void impeg2d_dec_pic_data(dec_state_t *ps_dec)
WORD32 i;
dec_state_multi_core_t *ps_dec_state_multi_core;
- UWORD32 u4_error_code;
-
dec_state_t *ps_dec_thd;
WORD32 i4_status;
WORD32 i4_min_mb_y;
@@ -1346,7 +1393,6 @@ void impeg2d_dec_pic_data(dec_state_t *ps_dec)
/* Resetting the MB address and MB coordinates at the start of the Frame */
ps_dec->u2_mb_x = ps_dec->u2_mb_y = 0;
- u4_error_code = 0;
ps_dec_state_multi_core = ps_dec->ps_dec_state_multi_core;
impeg2d_get_slice_pos(ps_dec_state_multi_core);
@@ -1390,8 +1436,6 @@ void impeg2d_dec_pic_data(dec_state_t *ps_dec)
}
}
- ps_dec->u4_error_code = u4_error_code;
-
}
/*******************************************************************************
*
@@ -1725,6 +1769,7 @@ IMPEG2D_ERROR_CODES_T impeg2d_process_video_bit_stream(dec_state_t *ps_dec)
else if((ps_dec->s_bit_stream.u4_offset < ps_dec->s_bit_stream.u4_max_offset)
&& (u4_next_bits == PICTURE_START_CODE))
{
+ ps_dec->i4_pic_count++;
e_error = impeg2d_dec_pic_hdr(ps_dec);
if ((IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE != e_error)
@@ -1741,7 +1786,11 @@ IMPEG2D_ERROR_CODES_T impeg2d_process_video_bit_stream(dec_state_t *ps_dec)
{
return e_error;
}
- impeg2d_pre_pic_dec_proc(ps_dec);
+ e_error = impeg2d_pre_pic_dec_proc(ps_dec);
+ if ((IMPEG2D_ERROR_CODES_T) IVD_ERROR_NONE != e_error)
+ {
+ return e_error;
+ }
impeg2d_dec_pic_data(ps_dec);
impeg2d_post_pic_dec_proc(ps_dec);
u4_start_code_found = 1;
@@ -1813,6 +1862,7 @@ IMPEG2D_ERROR_CODES_T impeg2d_process_video_bit_stream(dec_state_t *ps_dec)
else if ((impeg2d_bit_stream_nxt(ps_stream,START_CODE_LEN) == PICTURE_START_CODE)
&& (ps_dec->s_bit_stream.u4_offset < ps_dec->s_bit_stream.u4_max_offset))
{
+ ps_dec->i4_pic_count++;
e_error = impeg2d_dec_pic_hdr(ps_dec);
if ((IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE != e_error)
diff --git a/decoder/impeg2d_decoder.c b/decoder/impeg2d_decoder.c
index fa88bb5..8846066 100644
--- a/decoder/impeg2d_decoder.c
+++ b/decoder/impeg2d_decoder.c
@@ -98,12 +98,17 @@ void impeg2d_dec_hdr(void *pv_dec,impeg2d_video_decode_ip_t *ps_ip,
UWORD32 u4_bits_read;
dec_state_t *ps_dec;
+ UWORD32 u4_size = ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes;
ps_dec = (dec_state_t *)pv_dec;
ps_op->s_ivd_video_decode_op_t.u4_error_code = 0;
+ if (u4_size >= MAX_BITSTREAM_BUFFER_SIZE)
+ {
+ u4_size = MAX_BITSTREAM_BUFFER_SIZE - MIN_BUFFER_BYTES_AT_EOS;
+ }
impeg2d_bit_stream_init(&(ps_dec->s_bit_stream),ps_ip->s_ivd_video_decode_ip_t.pv_stream_buffer,
- ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes);
+ u4_size);
{
{
@@ -148,6 +153,12 @@ void impeg2d_dec_hdr(void *pv_dec,impeg2d_video_decode_ip_t *ps_ip,
ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes;
}
ps_op->s_ivd_video_decode_op_t.u4_frame_decoded_flag = 0;
+
+ /* Set the stride */
+ if (0 == ps_dec->u4_frm_buf_stride)
+ {
+ ps_dec->u4_frm_buf_stride = ps_dec->u2_horizontal_size;
+ }
/* MOD */
ps_dec->u2_header_done = 1;
@@ -189,12 +200,15 @@ void impeg2d_dec_frm(void *pv_dec,impeg2d_video_decode_ip_t *ps_ip,
ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = 0;
IMPEG2D_FRM_NUM_SET();
+ if (u4_size >= MAX_BITSTREAM_BUFFER_SIZE)
+ {
+ u4_size = MAX_BITSTREAM_BUFFER_SIZE - MIN_BUFFER_BYTES_AT_EOS;
+ }
ps_dec->pu1_inp_bits_buf = ps_ip->s_ivd_video_decode_ip_t.pv_stream_buffer;
ps_dec->u4_num_inp_bytes = u4_size;
ps_stream = &ps_dec->s_bit_stream;
-
impeg2d_bit_stream_init(ps_stream,ps_ip->s_ivd_video_decode_ip_t.pv_stream_buffer,u4_size);
/* @ */ /* Updating the bufferID */
diff --git a/decoder/impeg2d_mc.c b/decoder/impeg2d_mc.c
index 79c5ef6..229579c 100644
--- a/decoder/impeg2d_mc.c
+++ b/decoder/impeg2d_mc.c
@@ -1260,7 +1260,7 @@ void impeg2d_mc_fullx_fully(void *pv_dec,
for(i = 0; i < u4_blk_height; i++)
{
- memcpy(pu1_out, pu1_ref, u4_blk_width);
+ memmove(pu1_out, pu1_ref, u4_blk_width);
pu1_ref += u4_ref_wid;
pu1_out += u4_out_wid;
}
diff --git a/decoder/impeg2d_pnb_pic.c b/decoder/impeg2d_pnb_pic.c
index 5540044..f7937a8 100644
--- a/decoder/impeg2d_pnb_pic.c
+++ b/decoder/impeg2d_pnb_pic.c
@@ -77,6 +77,12 @@ WORD32 impeg2d_dec_p_mb_params(dec_state_t *ps_dec)
else
{
u2_mb_addr_incr = impeg2d_get_mb_addr_incr(ps_stream);
+
+ if(!u2_mb_addr_incr)
+ {
+ return IV_FAIL;
+ }
+
if(0 == ps_dec->u2_first_mb)
{
/****************************************************************/
@@ -116,6 +122,33 @@ WORD32 impeg2d_dec_p_mb_params(dec_state_t *ps_dec)
impeg2d_dec_skip_mbs(ps_dec, (UWORD16)(u2_mb_addr_incr - 1));
}
+ else
+ {
+
+ /****************************************************************/
+ /* Section 6.3.17 */
+ /* The first MB of a slice cannot be skipped */
+ /* But the mb_addr_incr can be > 1, because at the beginning of */
+ /* a slice, it indicates the offset from the last MB in the */
+ /* previous row. Hence for the first slice in a row, the */
+ /* mb_addr_incr needs to be 1. */
+ /****************************************************************/
+ /* MB_x is set to zero whenever MB_y changes. */
+ ps_dec->u2_mb_x = u2_mb_addr_incr - 1;
+ /* For error resilience */
+ ps_dec->u2_mb_x = MIN(ps_dec->u2_mb_x, (ps_dec->u2_num_horiz_mb - 1));
+ ps_dec->u2_num_mbs_left = ((ps_dec->u2_num_vert_mb - ps_dec->u2_mb_y)
+ * ps_dec->u2_num_horiz_mb) - ps_dec->u2_mb_x;
+
+ /****************************************************************/
+ /* mb_addr_incr is forced to 1 because in this decoder it is used */
+ /* more as an indicator of the number of MBs skipped than the */
+ /* as defined by the standard (Section 6.3.17) */
+ /****************************************************************/
+ u2_mb_addr_incr = 1;
+ ps_dec->u2_first_mb = 0;
+
+ }
}
u4_next_word = (UWORD16)impeg2d_bit_stream_nxt(ps_stream,16);
@@ -266,6 +299,11 @@ WORD32 impeg2d_dec_pnb_mb_params(dec_state_t *ps_dec)
{
u2_mb_addr_incr = impeg2d_get_mb_addr_incr(ps_stream);
+ if(0 == u2_mb_addr_incr)
+ {
+ return IV_FAIL;
+ }
+
if(ps_dec->u2_first_mb)
{
/****************************************************************/
@@ -280,6 +318,8 @@ WORD32 impeg2d_dec_pnb_mb_params(dec_state_t *ps_dec)
ps_dec->u2_mb_x = u2_mb_addr_incr - 1;
/* For error resilience */
ps_dec->u2_mb_x = MIN(ps_dec->u2_mb_x, (ps_dec->u2_num_horiz_mb - 1));
+ ps_dec->u2_num_mbs_left = ((ps_dec->u2_num_vert_mb - ps_dec->u2_mb_y)
+ * ps_dec->u2_num_horiz_mb) - ps_dec->u2_mb_x;
/****************************************************************/
/* mb_addr_incr is forced to 1 because in this decoder it is used */
@@ -510,6 +550,12 @@ IMPEG2D_ERROR_CODES_T impeg2d_dec_p_b_slice(dec_state_t *ps_dec)
if(ret)
return IMPEG2D_MB_TEX_DECODE_ERR;
+
+ if(0 >= ps_dec->u2_num_mbs_left)
+ {
+ break;
+ }
+
IMPEG2D_TRACE_MB_START(ps_dec->u2_mb_x, ps_dec->u2_mb_y);
u4_x_dst_offset = u4_frm_offset + (ps_dec->u2_mb_x << 4);
diff --git a/decoder/impeg2d_structs.h b/decoder/impeg2d_structs.h
index 03cd54c..bdda8b8 100644
--- a/decoder/impeg2d_structs.h
+++ b/decoder/impeg2d_structs.h
@@ -40,6 +40,7 @@ Because of temporal dependency in deinterlacer one additional buffer is also nee
#define DEC_ORDER 0
#define MAX_BITSTREAM_BUFFER_SIZE 2000 * 1024
+#define MIN_BUFFER_BYTES_AT_EOS 8
/* Flag to signal that buffer is held by deinterlacing */
#define MPEG2_BUF_MGR_DEINT (BUF_MGR_DISP << 1)
@@ -331,6 +332,9 @@ typedef struct dec_state_struct_t
UWORD8 *pu1_chroma_ref_buf[BUF_MGR_MAX_CNT];
ivd_out_bufdesc_t as_disp_buffers[BUF_MGR_MAX_CNT];
+ /* Count the number of pictures decoded after init/reset */
+ WORD32 i4_pic_count;
+
/* Flag to signal last coeff in a 8x8 block is one
after mismatch contol */
WORD32 i4_last_value_one;
@@ -359,6 +363,8 @@ typedef struct dec_state_struct_t
/* Number of bytes in the input bitstream */
UWORD32 u4_num_inp_bytes;
+ ivd_out_bufdesc_t *ps_out_buf;
+
/* Bytes consumed */
WORD32 i4_bytes_consumed;
diff --git a/test/decoder/main.c b/test/decoder/main.c
index 7a6db46..6229f50 100644
--- a/test/decoder/main.c
+++ b/test/decoder/main.c
@@ -2246,6 +2246,7 @@ int main(WORD32 argc, CHAR *argv[])
u4_ip_buf_len);
codec_exit(ac_error_str);
}
+
s_app_ctx.num_disp_buf = s_ctl_op.u4_num_disp_bufs;
/* Allocate output buffer only if display buffers are not shared */
/* Or if shared and output is 420P */
@@ -3012,6 +3013,12 @@ int main(WORD32 argc, CHAR *argv[])
break;
}
+ else if (IVD_DISP_FRM_ZERO_OP_BUF_SIZE ==
+ (IMPEG2D_ERROR_CODES_T)s_video_decode_op.u4_error_code)
+ {
+ printf("Output buffer is not large enough!\n");
+ break;
+ }
}
if((1 == s_app_ctx.display) &&