tweak mpeg2enc for nx 32bit segv, improve filempeg fileformat color/format popup
authorGood Guy <good1.2guy@gmail.com>
Fri, 8 Nov 2019 01:23:54 +0000 (18:23 -0700)
committerGood Guy <good1.2guy@gmail.com>
Fri, 8 Nov 2019 01:23:54 +0000 (18:23 -0700)
13 files changed:
cinelerra-5.1/cinelerra/filempeg.C
cinelerra-5.1/mpeg2enc/dist2_mmx.s
cinelerra-5.1/mpeg2enc/global.h
cinelerra-5.1/mpeg2enc/mblock_sad_mmx.s
cinelerra-5.1/mpeg2enc/mblock_sad_mmxe.s
cinelerra-5.1/mpeg2enc/mblockq_sad_mmxe.s
cinelerra-5.1/mpeg2enc/mpeg2enc.c
cinelerra-5.1/mpeg2enc/predcomp_mmx.s
cinelerra-5.1/mpeg2enc/predcomp_mmxe.s
cinelerra-5.1/mpeg2enc/predict_mmx.s
cinelerra-5.1/mpeg2enc/putseq.c
cinelerra-5.1/mpeg2enc/quant_mmx.s
cinelerra-5.1/mpeg2enc/quantize.c

index 986ac9289ee9ff93debcd54394d18430d8bb1ede..bd8da56ba95d07fef27bc697995b505357571d8b 100644 (file)
@@ -622,9 +622,16 @@ int FileMPEG::open_file(int rd, int wr)
                        sprintf(string, " -F %d", frame_rate_code);
                        strncat(mjpeg_command, string, sizeof(mjpeg_command));
 
+                       sprintf(string, " -H"); /* Maximize high-frequency resolution */
+                       strncat(mjpeg_command, string, sizeof(mjpeg_command));
 
-
-
+                       if(asset->vmpeg_preset == 3) /* no constrains for mpeg2 generic */
+                       {
+                               sprintf(string, " --no-constraints");
+                               strncat(mjpeg_command, string, sizeof(mjpeg_command));
+                               sprintf(string, " -V 500");
+                               strncat(mjpeg_command, string, sizeof(mjpeg_command));
+                       }
 
                        strncat(mjpeg_command,
                                asset->vmpeg_progressive ? " -I 0" : " -I 1",
@@ -1898,6 +1905,8 @@ void MPEGConfigVideo::create_objects()
        add_subwindow(cmodel = new MPEGColorModel(x1, y, this));
        cmodel->create_objects();
        y += yS(30);
+       add_subwindow(derivative = new MPEGDerivative(x1, y, this));
+       derivative->create_objects();
 
        update_cmodel_objs();
 
@@ -1916,7 +1925,6 @@ int MPEGConfigVideo::close_event()
 void MPEGConfigVideo::delete_cmodel_objs()
 {
        delete preset;
-       delete derivative;
        delete bitrate;
        delete fixed_bitrate;
        delete quant;
@@ -1934,7 +1942,6 @@ void MPEGConfigVideo::delete_cmodel_objs()
 void MPEGConfigVideo::reset_cmodel()
 {
        preset = 0;
-       derivative = 0;
        bitrate = 0;
        fixed_bitrate = 0;
        quant = 0;
@@ -1969,8 +1976,7 @@ void MPEGConfigVideo::update_cmodel_objs()
 
        add_subwindow(title = new BC_Title(x, y + ys5, _("Derivative:")));
        titles.append(title);
-       add_subwindow(derivative = new MPEGDerivative(x1, y, this));
-       derivative->create_objects();
+       derivative->reposition_window(x1, y);
        y += ys30;
 
        add_subwindow(title = new BC_Title(x, y + ys5, _("Bitrate:")));
@@ -2028,6 +2034,14 @@ void MPEGDerivative::create_objects()
 int MPEGDerivative::handle_event()
 {
        gui->asset->vmpeg_derivative = string_to_derivative(get_text());
+       if( gui->asset->vmpeg_derivative == 1 ) {
+               gui->asset->vmpeg_cmodel = BC_YUV420P;
+               char *text = MPEGColorModel::cmodel_to_string(gui->asset->vmpeg_cmodel);
+               gui->cmodel->set_text(text);
+       }
+       gui->cmodel->create_objects();
+       gui->update_cmodel_objs();
+       gui->show_window(1);
        return 1;
 };
 
@@ -2197,8 +2211,10 @@ MPEGColorModel::MPEGColorModel(int x, int y, MPEGConfigVideo *gui)
 
 void MPEGColorModel::create_objects()
 {
+       while( total_items() > 0 ) del_item(0);
        add_item(new BC_MenuItem(cmodel_to_string(BC_YUV420P)));
-       add_item(new BC_MenuItem(cmodel_to_string(BC_YUV422P)));
+       if( gui->asset->vmpeg_derivative == 2 )
+               add_item(new BC_MenuItem(cmodel_to_string(BC_YUV422P)));
 }
 
 int MPEGColorModel::handle_event()
@@ -2207,7 +2223,7 @@ int MPEGColorModel::handle_event()
        gui->update_cmodel_objs();
        gui->show_window(1);
        return 1;
-};
+}
 
 int MPEGColorModel::string_to_cmodel(char *string)
 {
index 0f41fd8271b9247c00d011b2011803247f77cb96..9ce4b94436872f44654e494454d2ef36ac260782 100644 (file)
@@ -51,6 +51,7 @@ twos:
                        dw      2
                        dw      2
 
+SECTION .text
 align 32
 dist2_mmx:
        push ebp                        ; save frame pointer
@@ -597,4 +598,4 @@ bd2top22:
                dec       edi
                jg        bd2top22
                jmp       d2exit
-                               
\ No newline at end of file
+
index 2826c09f2f688935870742ea5137209bd67e6ba2..a860e41c98b4e7c76bfa384222062ee4861a4e0e 100644 (file)
@@ -660,7 +660,7 @@ int quant_non_intra_hv( pict_data_s *picture,
                                                        int mquant, int *nonsat_mquant);
 void iquant_intra ( int16_t *src, int16_t *dst, int dc_prec, int mquant);
 void iquant_non_intra (int16_t *src, int16_t *dst, int mquant);
-void init_quantizer_hv();
+void init_quantizer_hv(int use_sse);
 int  next_larger_quant_hv( pict_data_s *picture, int quant );
 
 extern int (*pquant_non_intra)(pict_data_s *picture, int16_t *src, int16_t *dst,
index a58c580a5665d47c4152e4f2fcbcf517e61ce85c..fc75986bf8adbd3f8cb8634fbd01bf4d905d2e6a 100644 (file)
@@ -47,6 +47,7 @@ global dist1_00_mmx
 ; mm7 = temp
 
 
+SECTION .text
 align 32
 dist1_00_mmx:
        push ebp                ; save frame pointer
index 0aec5215814add1c8788e9af109e14f21534ceaf..de944139189585cfe9b9bc962fd58d0be01fcc5a 100644 (file)
@@ -48,6 +48,7 @@ global dist1_00_mmxe
 ; mm6 = temp
 
 
+SECTION .text
 align 32
 dist1_00_mmxe:
        push ebp                                        ; save frame pointer
index 0e57ea5ef45ef3b86f638adebe8b3989af0409cf..207b5ee3fdb9d5aef9cabc3069fe8b7201dd399e 100644 (file)
@@ -52,6 +52,7 @@ global mblockq_sad1_REF
 ; mm6 = temp
 ; mm7 = temp                                           
 
+SECTION .text
 align 32
 mblockq_dist1_REF:
        push ebp                                        ; save frame pointer
index 5452fb42e6e977b86473d77c29f1f7ba04febe24..af76232d8727b9f49fc0097f57dc48b7e41d0b36 100644 (file)
@@ -222,7 +222,8 @@ static void init()
        init_idct();
        init_motion();
        init_predict_hv();
-       init_quantizer_hv();
+       int use_sse = chroma_format==CHROMA420 ? 1 : 0;
+       init_quantizer_hv(use_sse);
        init_transform_hv();
 
 /* round picture dimensions to nZearest multiple of 16 or 32 */
index 82fd01f7f1cfbd14804d79969eda795abe909e0e..281362000db34654cf1e9730ef2bbf016f280540 100644 (file)
@@ -45,6 +45,7 @@ global predcomp_00_mmx
                
 
 
+SECTION .text
 align 32
 predcomp_00_mmx:
        push ebp                                        ; save frame pointer
index a2d04130ea6dd749e3e338b4976dcbf25bfa1350..aae425bf7d10c582457e551ebbad11ee2795f61c 100644 (file)
@@ -44,6 +44,7 @@ global predcomp_00_mmxe
 ;;; mm0 = zero mask for src...
                
 
+SECTION .text
 align 32
 predcomp_00_mmxe:
        push ebp                                        ; save frame pointer
index dac799096b17d677b8d5a51a280edc0d2aa381ee..ac8015c1cc9d0198797747139ef685d4a68adc64 100644 (file)
@@ -25,6 +25,7 @@
 ;                  unsigned char *cur,
 ;                  int lx, short *blk)
 
+SECTION .text
 align 32
 global sub_pred_mmx
 sub_pred_mmx:
index 30acf79e6850a9387fb395f7db05740d0cb7be1a..de3ec5f5cb3514f375146c4ad0c1da84d0f91c65 100644 (file)
@@ -360,5 +360,5 @@ void putseq()
 //printf("putseq 7\n");
        }
        putseqend();
-       if(verbose) fprintf(stderr, "\nDone.  Be sure to visit heroinewarrior.com for updates.\n");
+       if(verbose) fprintf(stderr, "\nDone.\n");
 }
index c206918e63b063f34a7261ad738b83f5210d5455..5ba353915f2c6287dba7ac6ccf1b9f039c160ff5 100644 (file)
@@ -63,8 +63,6 @@ align 32
 quant_buf:     resw 64
                
 SECTION .text
-               
-
 align 32
 quantize_ni_mmx:
        push ebp                                ; save frame pointer
index f842843d2ea5f4d66cfc9ac462bcc8232c30da5b..dd6740e961c9487fa201532a11c28d004ecf6914 100644 (file)
@@ -57,7 +57,7 @@ static void iquant_non_intra_m1(int16_t *src, int16_t *dst, uint16_t *quant_mat)
   Currently just setting up MMX routines if available...
  */
 
-void init_quantizer_hv()
+void init_quantizer_hv(int use_sse)
 {
 #ifdef X86_CPU
   int flags;
@@ -86,7 +86,8 @@ void init_quantizer_hv()
                {
                        if(verbose) fprintf( stderr, "EXTENDED MMX");
                        pquant_weight_coeff_sum = quant_weight_coeff_sum_mmx;
-                       piquant_non_intra_m1 = iquant_non_intra_m1_sse;
+                       if( use_sse )
+                               piquant_non_intra_m1 = iquant_non_intra_m1_sse;
                }
                else
                {